diff --git a/spring-cloud/spring-cloud-security/personresource/pom.xml b/spring-cloud/spring-cloud-security/personresource/pom.xml
index 783fd41e66..ca1ff82515 100644
--- a/spring-cloud/spring-cloud-security/personresource/pom.xml
+++ b/spring-cloud/spring-cloud-security/personresource/pom.xml
@@ -43,10 +43,6 @@
org.springframework.security
spring-security-jwt
-
- com.google.code.gson
- gson
-
diff --git a/spring-cloud/spring-cloud-security/personresource/src/main/java/com/baeldung/controller/PersonInfoController.java b/spring-cloud/spring-cloud-security/personresource/src/main/java/com/baeldung/controller/PersonInfoController.java
index 15ffc557fc..9e5420da5a 100644
--- a/spring-cloud/spring-cloud-security/personresource/src/main/java/com/baeldung/controller/PersonInfoController.java
+++ b/spring-cloud/spring-cloud-security/personresource/src/main/java/com/baeldung/controller/PersonInfoController.java
@@ -6,16 +6,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.baeldung.model.Person;
-import com.google.gson.Gson;
@RestController
public class PersonInfoController {
@GetMapping("/personResource")
@PreAuthorize("hasAnyRole('ADMIN', 'USER')")
- public @ResponseBody String personInfo() {
- Gson gson = new Gson();
- String person = gson.toJson(new Person("abir", "Dhaka", "Bangladesh", 29, "Male"));
- return person;
+ public @ResponseBody Person personInfo() {
+ return new Person("abir", "Dhaka", "Bangladesh", 29, "Male");
}
}
\ No newline at end of file