commit
a3585ddc8e
|
@ -43,10 +43,6 @@
|
|||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-jwt</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue