|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value={TYPE,METHOD}) @Retention(value=RUNTIME) @Documented public @interface Scope
When used as a type-level annotation in conjunction with the Component
annotation, indicates the name of a scope to use for instances of the annotated
type.
When used as a method-level annotation in conjunction with the
Bean
annotation, indicates the name of a scope to use for
the instance returned from the method.
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
via ConfigurableBeanFactory
and WebApplicationContext
interfaces.
To register additional custom scopes, see
CustomScopeConfigurer
.
Component
,
Bean
Optional Element Summary | |
---|---|
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 |
value
Specifies the scope to use for the annotated component/bean. |
public abstract String value
ConfigurableBeanFactory.SCOPE_SINGLETON
,
ConfigurableBeanFactory.SCOPE_PROTOTYPE
,
WebApplicationContext.SCOPE_REQUEST
,
WebApplicationContext.SCOPE_SESSION
public abstract ScopedProxyMode proxyMode
Defaults to ScopedProxyMode.NO
, indicating that no scoped
proxy should be created.
Analogous to <aop:scoped-proxy/>
support in Spring XML.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |