org.springframework.context.annotation

## 注释类型 Scope

-     @Target(value={TYPE,METHOD})
       @Retention(value=RUNTIME)
       @Documented
      public @interface Scope

  When used as a type-level annotation in conjunction with `@Component`, `@Scope` indicates the name of a scope to use for instances of the annotated type.

  When used as a method-level annotation in conjunction with `@Bean`, `@Scope` indicates the name of a scope to use for the instance returned from the method.

  NOTE: `@Scope` annotations are only introspected on the concrete bean class (for annotated components) or the factory method (for `@Bean` methods). In contrast to XML bean definitions, there is no notion of bean definition inheritance, and inheritance hierarchies at the class level are irrelevant for metadata purposes.

  In this context, scope means the lifecycle of an instance, such as `singleton`, `prototype`, and so forth. Scopes provided out of the box in Spring may be referred to using the `SCOPE_*` constants available in the `ConfigurableBeanFactory` and `WebApplicationContext` interfaces.

  To register additional custom scopes, see `CustomScopeConfigurer`.

  从以下版本开始:
    2.5
  作者:
    Mark Fisher, Chris Beams, Sam Brannen
  另请参阅:
    `Component`, `Bean`

- - ### 可选元素概要

    可选元素
    限定符和类型 | 可选元素和说明
    --- | ---
    `ScopedProxyMode` | `proxyMode` Specifies whether a component should be configured as a scoped proxy and if so, whether the proxy should be interface-based or subclass-based.
    `String` | `scopeName` Specifies the name of the scope to use for the annotated component/bean.
    `String` | `value` Alias for `scopeName()`.

- - ### 元素详细资料

    - #### value

          @AliasFor(value="scopeName")
          public abstract String value

      Alias for `scopeName()`.
      另请参阅:
        `scopeName()`
      默认值:
        ""

  - - #### scopeName

          @AliasFor(value="value")
          public abstract String scopeName

      Specifies the name of the scope to use for the annotated component/bean.

      Defaults to an empty string (`""`) which implies `SCOPE_SINGLETON`.

      从以下版本开始:
        4.2
      另请参阅:
        `ConfigurableBeanFactory.SCOPE_PROTOTYPE`, `ConfigurableBeanFactory.SCOPE_SINGLETON`, `org.springframework.web.context.WebApplicationContext#SCOPE_REQUEST`, `org.springframework.web.context.WebApplicationContext#SCOPE_SESSION`, `value()`
      默认值:
        ""

  - - #### proxyMode

          public abstract ScopedProxyMode proxyMode

      Specifies whether a component should be configured as a scoped proxy and if so, whether the proxy should be interface-based or subclass-based.

      Defaults to `ScopedProxyMode.DEFAULT`, which typically indicates that no scoped proxy should be created unless a different default has been configured at the component-scan instruction level.

      Analogous to `<aop:scoped-proxy/>` support in Spring XML.

      另请参阅:
        `ScopedProxyMode`
      默认值:
        org.springframework.context.annotation.ScopedProxyMode.DEFAULT