목록json (1)
늘
@RestController와 @ResponseBody없이 json으로 통신하는 방법
ResponseEntity의 body에 객체를 넣고 보내주면 json형식으로 주고받아진다. @Controller public class HelloController { @GetMapping(path = "/hello") public ResponseEntity hello() { MoveDto moveDto = new MoveDto("start", "finish"); return ResponseEntity.ok(moveDto); } } @Controller를 통해서 Json이 반환되는 현상이 발생했습니다.. 흔히들 알기론 controller는 데이터를 Model에 담고 반환할 view를 찾는 방식이고 restController는 단순히 json형식의 데이터만 주고받는 것으로 알고 있습니다. 그리고 RestC..
백앤드 개발일지/스프링부트
2022. 4. 30. 00:07