spring-framework / org.springframework.web.bind.annotation / RestController

RestController

@Target([AnnotationTarget.CLASS, AnnotationTarget.FILE]) @Controller @ResponseBody class RestController

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.

NOTE: @RestController is processed if an appropriate HandlerMapping-HandlerAdapter pair is configured such as the RequestMappingHandlerMapping-RequestMappingHandlerAdapter pair which are the default in the MVC Java config and the MVC namespace.

Author
Rossen Stoyanchev

Author
Sam Brannen

Since
4.0

Constructors

<init>

RestController(value: String)

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.

NOTE: @RestController is processed if an appropriate HandlerMapping-HandlerAdapter pair is configured such as the RequestMappingHandlerMapping-RequestMappingHandlerAdapter pair which are the default in the MVC Java config and the MVC namespace.

Properties

value

val value: String

The value may indicate a suggestion for a logical component name, to be turned into a Spring bean in case of an autodetected component.