JAVA/코딩
Spring @PostMapping @GetMapping @PatchMapping @PutMapping @DeleteMapping
으악꿈
2021. 2. 25. 09:24
728x90
Spring 4.3 버전 이후로 MVC 컨트롤러 메서드를 위한 어노테이션이 추가되었습니다.
- @PostMapping
- @GetMapping
- @PatchMapping
- @PutMapping
- @DeleteMapping
기존에 아래와 같이 어노테이션을 선언하는 방법과 달리
@RequestMapping(value="/test.do", method=RequestMethod.POST)
public void test(){}
다음과 같이 간편하게 사용할 수 있습니다.
@PostMapping("/test.do")
public void test(){}
참고 : github.com/spring-projects/spring-framework/issues/18022#issue-398183908
728x90