@GetMapping과 @RequestMapping의 차이점
·
Spring Boot
@GetMapping: @RequestMapping의 축약형으로, HTTP의 GET 요청만 처리합니다.@GetMapping("/example")public String example() { return "example";}- 메서드 속성을 명시하지 않아도, GET 전용 요청으로 작동합니다. @RequestMapping: HTTP 요청을 특정 URL과 메서드에 매핑합니다.@RequestMapping(value = "/example", method = RequestMethod.GET)public String example() { return "example";}- path, method 등의 속성을 사용하여 요청을 세부적으로 정의할 수 있습니다.