@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.
org.springframework.stereotype.Component , org.springframework.context.annotation.Bean
| Modifier and Type | Method and Description |
|---|---|
| public 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. |
| public String | |
| public String |
| proxyMode | back to summary |
|---|---|
| public 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 Analogous to
| |
| scopeName | back to summary |
|---|---|
| public String scopeName() Specifies the name of the scope to use for the annotated component/bean. Defaults to an empty string ( | |
| value | back to summary |
|---|---|
| public String value() Alias for | |