From 9d51cfae5c66b699da449b8f06a0ccd44ee63d99 Mon Sep 17 00:00:00 2001 From: Sachin Raverkar Date: Wed, 25 Oct 2023 17:39:06 +0530 Subject: [PATCH] Updated controller code examples. --- .../javaconfig/controllers/DepartmentController.java | 4 +--- .../javaconfig/controllers/EmployeeController.java | 4 +--- .../javaconfig/controllers/OrganizationController.java | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/DepartmentController.java b/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/DepartmentController.java index 9d6b0d59c..cf75cc0fe 100644 --- a/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/DepartmentController.java +++ b/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/DepartmentController.java @@ -8,8 +8,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; - @RestController @RequestMapping("/departments") public class DepartmentController { @@ -18,7 +16,7 @@ public class DepartmentController { @Qualifier(value = "core") private Department core; - @GetMapping(value = "{id}", produces = APPLICATION_JSON_VALUE) + @GetMapping(value = "{id}") public Department getDepartmentById(@PathVariable("id") final Long id) { return core; } diff --git a/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/EmployeeController.java b/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/EmployeeController.java index 0f358fcc0..6f456ae24 100644 --- a/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/EmployeeController.java +++ b/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/EmployeeController.java @@ -8,8 +8,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; - @RestController @RequestMapping("/employees") public class EmployeeController { @@ -18,7 +16,7 @@ public class EmployeeController { @Qualifier(value = "founder") private Employee founder; - @GetMapping(value = "{id}", produces = APPLICATION_JSON_VALUE) + @GetMapping(value = "{id}") public Employee getEmployeeById(@PathVariable("id") final Long id) { return founder; } diff --git a/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/OrganizationController.java b/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/OrganizationController.java index f2c5d620c..b649ca7e9 100644 --- a/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/OrganizationController.java +++ b/spring-boot/java-config/src/main/java/io/reflectoring/javaconfig/controllers/OrganizationController.java @@ -8,8 +8,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; - @RestController @RequestMapping("/organizations") public class OrganizationController { @@ -18,7 +16,7 @@ public class OrganizationController { @Qualifier(value = "acme") private Organization acme; - @GetMapping(value = "{id}", produces = APPLICATION_JSON_VALUE) + @GetMapping(value = "{id}") public Organization getOrganizationById(@PathVariable("id") final Long id) { return acme; }