Top Description Methods
org.springframework.web.bind.annotation

public @Interface RestController

extends Annotation
Annotations
@Target:TYPE
@Retention:RUNTIME
@Documented
@Controller
@ResponseBody
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.springframework.core.annotation.AliasFor, org.springframework.stereotype.Controller

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.

Authors
Rossen Stoyanchev, Sam Brannen
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the suggested component name, if any (or empty String otherwise)
value
()

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

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public String value()

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

Returns:String

the suggested component name, if any (or empty String otherwise)

Annotations
@AliasFor
annotation:Controller
Since
4.0.1