|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=TYPE) @Documented public @interface ComponentScan
Scans the classpath for annotated components that will be auto-registered as
Spring beans. By default, the Spring-provided @Component
, @Repository
,
@Service
, and @Controller
stereotypes will be detected.
<context:component-scan/>
element.
attributes of this annotation are in a 1:1 relationship (as much as is technically possible)
with the attributes and child elements found in component-scan
.
Note: This annotation implies the effects of the AnnotationDrivenConfig
annotation,
activating @Required, @Autowired
, @PostConstruct
, @PreDestroy
,
@Resource
, @PersistenceContext
and @PersistenceUnit
annotations in the component classes, which is usually desired for autodetected components
(without external configuration). Turn off the 'annotationConfig' attribute to deactivate
this default behavior, for example in order to use custom BeanPostProcessor definitions
for handling those annotations.
Note: Placeholders in package paths is NOT supported at this time (a deviation from the
XML support for <context:component-scan/>
).
Required Element Summary | |
---|---|
java.lang.String[] |
value
One or more base packages to scan. |
Optional Element Summary | |
---|---|
boolean |
annotationConfig
Whether to enable annotation-driven configuration during component scanning. |
java.lang.Class<? extends org.springframework.beans.factory.support.BeanNameGenerator> |
nameGenerator
Specifies the bean naming strategy for naming a component-scanned bean definition. |
java.lang.String |
resourcePattern
Defaults to empty string, will delegate to default resource pattern defined by ClassPathScanningCandidateComponentProvider. |
org.springframework.context.annotation.ScopedProxyMode |
scopedProxy
|
java.lang.Class<? extends org.springframework.context.annotation.ScopeMetadataResolver> |
scopeResolver
Specifies the strategy for determining the scope of a component-scanned bean definition. |
boolean |
useDefaultFilters
Whether to use Spring's default set of filters. |
Element Detail |
---|
public abstract java.lang.String[] value
public abstract org.springframework.context.annotation.ScopedProxyMode scopedProxy
public abstract boolean annotationConfig
@Autowired
constructors.
public abstract java.lang.String resourcePattern
ClassPathScanningCandidateComponentProvider.DEFAULT_RESOURCE_PATTERN
public abstract boolean useDefaultFilters
#includeFilters()
or #excludeFilters()
are specified.
ClassPathScanningCandidateComponentProvider.registerDefaultFilters()
public abstract java.lang.Class<? extends org.springframework.beans.factory.support.BeanNameGenerator> nameGenerator
AnnotationBeanNameGenerator
.
ClassPathBeanDefinitionScanner.setBeanNameGenerator(BeanNameGenerator)
public abstract java.lang.Class<? extends org.springframework.context.annotation.ScopeMetadataResolver> scopeResolver
AnnotationScopeMetadataResolver
, which understands the @Scope
annotation.
ClassPathBeanDefinitionScanner.setScopeMetadataResolver(ScopeMetadataResolver)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |