기존의 맵핑 방법인 @RequestMapping을 보완하여 스프링 4.3버전부터 @GetMapping, @PostMapping, @DeleteMapping, @PutMapping, @PatchMapping 등이 추가됨
● 기존의 맵핑 방식 (@RequestMapping)
@RequestMapping("/memJoin") // get방식
@RequestMapping(value="/memJoin" method="RequestMethod.GET")
public String Test(HttpServletRequest request, HttpServletResponse response) {
....
}
@RequestMapping(value="/memJoin" method="RequestMethod.POST") // post방식(delete, put, patch)
public String Test2(HttpServletRequest request, HttpServletResponse response) {
....
}
● 추가된 맵핑 방식 (@GetMapping, @PostMapping, @DeleteMapping, @PutMapping, @PatchMapping)
@GetMapping(value="/memJoin") // get방식
public String Test(HttpServletRequest request, HttpServletResponse response) {
....
}
@PostMapping(value="/memJoin") // post방식
public String Test2(HttpServletRequest request, HttpServletResponse response) {
....
}
@DeleteMapping(value="/memJoin") // delete방식
public String Test2(HttpServletRequest request, HttpServletResponse response) {
....
}
@PutMapping(value="/memJoin") // put방식
public String Test2(HttpServletRequest request, HttpServletResponse response) {
....
}
@PatchMapping(value="/memJoin") // patch방식
public String Test2(HttpServletRequest request, HttpServletResponse response) {
....
}
'Framework > Spring' 카테고리의 다른 글
[Mybatis] 자바 Annotation (0) | 2020.09.23 |
---|---|
[Mybatis] resultMap, association, collection (0) | 2020.09.22 |
Mybatis (0) | 2020.09.18 |
[JDBC] Mybatis, JPA, Hibernate (0) | 2020.09.18 |
Spring AOP (0) | 2020.09.18 |