Annotation Interface RestController


@Documented @ResponseBody @Retention(RUNTIME) @Target({TYPE,METHOD}) public @interface 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.

从以下版本开始:
2018-11-17 21:26
作者:
Rossen Stoyanchev, Sam Brannen, Harry Yang
  • 可选元素概要

    可选元素
    修饰符和类型
    可选元素
    说明
    boolean
    Is this bean a candidate for getting autowired into some other bean?
    The optional names of a method to call on the bean instance upon closing the application context, for example a close() method on a JDBC DataSource implementation, or a Hibernate SessionFactory object.
    The optional name of a method to call on the bean instance during initialization.
    The value may indicate a suggestion for a logical component name, to be turned into a Infra bean in case of an autodetected component.
  • 元素详细资料

    • value

      @AliasFor(annotation=cn.taketoday.stereotype.Controller.class) String[] value
      The value may indicate a suggestion for a logical component name, to be turned into a Infra bean in case of an autodetected component.
      返回:
      the suggested component name, if any (or empty String otherwise)
      默认值:
      {}
    • initMethods

      @AliasFor(annotation=cn.taketoday.stereotype.Component.class) String[] initMethods
      The optional name of a method to call on the bean instance during initialization. Not commonly used, given that the method may be called programmatically directly within the body of a Bean-annotated method.

      The default value is "", indicating no init method to be called.

      另请参阅:
      • InitializingBean
      • ConfigurableApplicationContext.refresh()
      默认值:
      {}
    • destroyMethod

      @AliasFor(annotation=cn.taketoday.stereotype.Component.class) String destroyMethod
      The optional names of a method to call on the bean instance upon closing the application context, for example a close() method on a JDBC DataSource implementation, or a Hibernate SessionFactory object. The method must have no arguments but may throw any exception.

      Note: Only invoked on beans whose lifecycle is under the full control of the factory, which is always the case for singletons but not guaranteed for any other scope.

      另请参阅:
      • DisposableBean
      • ConfigurableApplicationContext.close()
      默认值:
      "(inferred)"
    • autowireCandidate

      @AliasFor(annotation=cn.taketoday.stereotype.Component.class) boolean autowireCandidate
      Is this bean a candidate for getting autowired into some other bean?

      Default is true; set this to false for internal delegates that are not meant to get in the way of beans of the same type in other places.

      从以下版本开始:
      4.0
      默认值:
      true