commit
a3585ddc8e
|
@ -43,10 +43,6 @@
|
||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-jwt</artifactId>
|
<artifactId>spring-security-jwt</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|
|
@ -6,16 +6,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.baeldung.model.Person;
|
import com.baeldung.model.Person;
|
||||||
import com.google.gson.Gson;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class PersonInfoController {
|
public class PersonInfoController {
|
||||||
|
|
||||||
@GetMapping("/personResource")
|
@GetMapping("/personResource")
|
||||||
@PreAuthorize("hasAnyRole('ADMIN', 'USER')")
|
@PreAuthorize("hasAnyRole('ADMIN', 'USER')")
|
||||||
public @ResponseBody String personInfo() {
|
public @ResponseBody Person personInfo() {
|
||||||
Gson gson = new Gson();
|
return new Person("abir", "Dhaka", "Bangladesh", 29, "Male");
|
||||||
String person = gson.toJson(new Person("abir", "Dhaka", "Bangladesh", 29, "Male"));
|
|
||||||
return person;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue