@Target([AnnotationTarget.CLASS, AnnotationTarget.FILE, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) class Scope
When used as a type-level annotation in conjunction with org.springframework.stereotype.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.
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 org.springframework.beans.factory.config.CustomScopeConfigurer.
Author
Mark Fisher
Author
Chris Beams
Author
Sam Brannen
Since
2.5
See Also
org.springframework.stereotype.Componentorg.springframework.context.annotation.Bean
Scope(value: String, scopeName: String, proxyMode: ScopedProxyMode)
When used as a type-level annotation in conjunction with org.springframework.stereotype.Component, When used as a method-level annotation in conjunction with Bean, In this context, scope means the lifecycle of an instance, such as To register additional custom scopes, see org.springframework.beans.factory.config.CustomScopeConfigurer. |
val proxyMode: ScopedProxyMode
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 Analogous to |
|
val scopeName: String
Specifies the name of the scope to use for the annotated component/bean. Defaults to an empty string ( |
|
val value: String
Alias for |