BAEL-2988 Make the code consistent with the article. (#7870)

* BAEL-2988 Make the code consistent with the article.

* BAEL-2988 Use @GetMapping annotation based on the feedback.
This commit is contained in:
wugangca 2019-09-26 21:25:57 -06:00 committed by KevinGilmore
parent 9ad7ed0e2f
commit cc23ac598a
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package com.baeldung.cors; package com.baeldung.cors;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -13,12 +14,12 @@ import com.baeldung.model.Modes;
@RequestMapping("/enums") @RequestMapping("/enums")
public class EnumController { public class EnumController {
@RequestMapping("/mode2str") @GetMapping("/mode2str")
public String getStringToMode(@RequestParam("mode") Modes mode) { public String getStringToMode(@RequestParam("mode") Modes mode) {
return "good"; return "good";
} }
@RequestMapping("/findbymode/{mode}") @GetMapping("/findbymode/{mode}")
public String findByEnum(@PathVariable Modes mode) { public String findByEnum(@PathVariable Modes mode) {
return "good"; return "good";
} }

View File

@ -1,5 +1,5 @@
package com.baeldung.model; package com.baeldung.model;
public enum Modes { public enum Modes {
ALPHA, DELTA ALPHA, BETA;
} }