728x90
postmapping
-
Spring Boot - POST APIFramework & Library/Spring Boot 2022. 2. 1. 14:43
POST API @PostMapping @PostMapping(value = "/default") public String postMethod() { return "Hello World"; } - POST API를 제작하기 위해 사용되는 애너테이션이다. - "@RequestMapping"과 POST method가 결합된 애너테이션이다. - 일반적으로 추가하고자 하는 리소스를 HTTP Body에 담아서 서버에 요청하지만, 그냥 요청을 해도 응답을 받는 모습을 확인할 수 있다. @RequestBody @PostMapping("/member01") public String postMember(@RequestBody Map postData) { StringBuilder sb = new StringBuilder(..