java.lang.Object | |
↳ | org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider |
Known Direct Subclasses |
A component provider that scans the classpath from a base package. It then applies exclude and include filters to the resulting classes to find candidates.
This implementation is based on Spring's
MetadataReader
facility, backed by an ASM org.springframework.asm.ClassReader ClassReader.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a ClassPathScanningCandidateComponentProvider.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add an exclude type filter to the front of the exclusion list.
| |||||||||||
Add an include type filter to the end of the inclusion list.
| |||||||||||
Scan the class path for candidate components.
| |||||||||||
Return the Environment for this object
| |||||||||||
Return the ResourceLoader that this component provider uses.
| |||||||||||
Reset the configured type filters.
| |||||||||||
Set the Environment to use when resolving placeholders and evaluating
@Profile -annotated component classes. | |||||||||||
Set the ResourceLoader to use for resource locations.
| |||||||||||
Set the resource pattern to use when scanning the classpath.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Determine whether the given class does not match any exclude filter
and does match at least one include filter.
| |||||||||||
Determine whether the given bean definition qualifies as candidate.
| |||||||||||
Register the default filter for
@Component . | |||||||||||
Resolve the specified base package into a pattern specification for
the package search path.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.context.ResourceLoaderAware
| |||||||||||
From interface
org.springframework.core.env.EnvironmentCapable
|
Create a ClassPathScanningCandidateComponentProvider.
useDefaultFilters | whether to register the default filters for the
@Component , @Repository ,
@Service , and @Controller
stereotype annotations |
---|
Add an exclude type filter to the front of the exclusion list.
Add an include type filter to the end of the inclusion list.
Scan the class path for candidate components.
basePackage | the package to check for annotated classes |
---|
Return the ResourceLoader that this component provider uses.
Reset the configured type filters.
useDefaultFilters | whether to re-register the default filters for
the @Component , @Repository ,
@Service , and @Controller
stereotype annotations |
---|
Set the Environment to use when resolving placeholders and evaluating
@Profile
-annotated component classes.
The default is a DefaultEnvironment
environment | the Environment to use |
---|
Set the ResourceLoader to use for resource locations. This will typically be a ResourcePatternResolver implementation.
Default is PathMatchingResourcePatternResolver, also capable of resource pattern resolving through the ResourcePatternResolver interface.
resourceLoader | ResourceLoader object to be used by this object |
---|
Set the resource pattern to use when scanning the classpath. This value will be appended to each base package name.
findCandidateComponents(String)
Determine whether the given class does not match any exclude filter and does match at least one include filter.
metadataReader | the ASM ClassReader for the class |
---|
IOException |
---|
Determine whether the given bean definition qualifies as candidate.
The default implementation checks whether the class is concrete (i.e. not abstract and not an interface). Can be overridden in subclasses.
beanDefinition | the bean definition to check |
---|
Register the default filter for @Component
.
This will implicitly register all annotations that have the
@Component
meta-annotation including the
@Repository
, @Service
, and
@Controller
stereotype annotations.
Also supports Java EE 6's javax.annotation.ManagedBean and JSR-330's javax.inject.Named annotations, if available.
Resolve the specified base package into a pattern specification for the package search path.
The default implementation resolves placeholders against system properties, and converts a "."-based package path to a "/"-based resource path.
basePackage | the base package as specified by the user |
---|