memostack
article thumbnail
Spring @ResponseBody를 이용하여 데이터 반환 (API 개발)
Backend/Spring 2021. 5. 17. 16:28

보통은 @Controller 어노테이션을 이용하여 Controller를 생성했을때, (ViewResolver에 의해) return 값으로 반환하는 문자열 이름의 view 페이지를 띄어준다. (아래 예시 코드 참고) 더보기 HelloCotroller.java import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller public..