From cc23ac598a3eb3aa8665eee0501b26810d4914ca Mon Sep 17 00:00:00 2001 From: wugangca Date: Thu, 26 Sep 2019 21:25:57 -0600 Subject: [PATCH] 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. --- .../src/main/java/com/baeldung/cors/EnumController.java | 5 +++-- .../src/main/java/com/baeldung/model/Modes.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-rest-simple/src/main/java/com/baeldung/cors/EnumController.java b/spring-rest-simple/src/main/java/com/baeldung/cors/EnumController.java index 6bd5a16439..34ce4d3927 100644 --- a/spring-rest-simple/src/main/java/com/baeldung/cors/EnumController.java +++ b/spring-rest-simple/src/main/java/com/baeldung/cors/EnumController.java @@ -1,6 +1,7 @@ package com.baeldung.cors; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -13,12 +14,12 @@ import com.baeldung.model.Modes; @RequestMapping("/enums") public class EnumController { - @RequestMapping("/mode2str") + @GetMapping("/mode2str") public String getStringToMode(@RequestParam("mode") Modes mode) { return "good"; } - @RequestMapping("/findbymode/{mode}") + @GetMapping("/findbymode/{mode}") public String findByEnum(@PathVariable Modes mode) { return "good"; } diff --git a/spring-rest-simple/src/main/java/com/baeldung/model/Modes.java b/spring-rest-simple/src/main/java/com/baeldung/model/Modes.java index a82df17d7d..d3a1ab4a61 100644 --- a/spring-rest-simple/src/main/java/com/baeldung/model/Modes.java +++ b/spring-rest-simple/src/main/java/com/baeldung/model/Modes.java @@ -1,5 +1,5 @@ package com.baeldung.model; public enum Modes { - ALPHA, DELTA + ALPHA, BETA; }