728x90
RequestMapping
-
Spring Boot - GET APIFramework & Library/Spring Boot 2022. 1. 31. 20:21
GET API @RestController - Spring Framework 4 버전부터 사용 가능한 애너테이션이다. - "@Controller"와 "@ResponseBody"가 결합된 애너테이션이다. - 컨트롤러 클래스 하위 메서드에 "@ResponseBody" 애너테이션을 붙이지 않아도 문자열, JSON 등을 전송할 수 있다. - View를 거치지 않고 HTTP ResponseBody에 직접 리턴 값을 담아 보내게 된다. @RequestMapping @RequestMapping(value = "/hello", method = RequestMethod.GET) public String hello() { return "Hello World"; } - 요청에 대해서 어떤 컨트롤러가 처리할지를 매핑하기 위한..