본문 바로가기
java/spring annotation

@RestController

by 일상코더 2022. 10. 6.
A convenience annotation that is itself annotated with @Controller and @ResponseBody.

Types that carry this annotation are treated as controllers 

where @RequestMapping methods assume @ResponseBody semantics by default.

 

@Controller 및 @ResponseBody로 자체 주석이 달린 편리한 주석.

이 주석을 포함하는 유형은 @RequestMapping 메서드가 

기본적으로 @ResponseBody 의미 체계를 띠고 있는 컨트롤러로 처리됩니다.

 

 

@RestController를 입은 컨트롤러는 요청 매핑 애노테이션을 붙인 

메서드의 리턴으로 경로를 반환하는 것이 아니라 '객체' 를 반환합니다.

 

https://1sangcoder.tistory.com/128

 

Spring 서버에서 객체를 JSON으로 변환 후 응답하기

JSON 응답 클라이언트는 서버를 거쳐서 DB에 접근한다. 클라이언트가 DB에서 필요한 정보를 얻기 위해, 서버에게 데이터를 요청하면 서버에서는 클라이언트가 필요한 데이터 또는 그 데이터가 포

1sangcoder.tistory.com

 

'java > spring annotation' 카테고리의 다른 글

@RequestParam, @RequestBody  (0) 2022.11.05
@GetMapping  (0) 2022.10.06

댓글