Annotation Type Bean


@Retention(CLASS) @Target(METHOD) public @interface Bean

A method of a Configuration class whose return value is a bean.

Its parameters are injected like a constructor's, and may carry Qualifier or Value. A static @Bean method is called without constructing the configuration class.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    A no-argument method of the returned object the build calls when the server stops.
    A no-argument method of the returned object the build calls once it is constructed and injected.
    The bean's name.
  • Element Details

    • value

      String value
      The bean's name. Empty means the method's name, which is Spring's rule.
      Default:
      ""
    • initMethod

      String initMethod
      A no-argument method of the returned object the build calls once it is constructed and injected. Empty for none.
      Default:
      ""
    • destroyMethod

      String destroyMethod
      A no-argument method of the returned object the build calls when the server stops. Empty for none.
      Default:
      ""