|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider org.springframework.context.annotation.ClassPathBeanDefinitionScanner
public class ClassPathBeanDefinitionScanner
A bean definition scanner that detects bean candidates on the classpath, registering corresponding bean definitions with a given registry (BeanFactory or ApplicationContext).
Candidate classes are detected through configurable type filters. The
default filters include classes that are annotated with Spring's
@Component
,
@Repository
,
@Service
, or
@Controller
stereotype.
Component
,
Repository
,
Service
,
Controller
Field Summary |
---|
Fields inherited from class org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider |
---|
DEFAULT_RESOURCE_PATTERN |
Constructor Summary | |
---|---|
ClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry)
Create a new ClassPathBeanDefinitionScanner for the given bean factory. |
|
ClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry,
boolean useDefaultFilters)
Create a new ClassPathBeanDefinitionScanner for the given bean factory. |
Method Summary | |
---|---|
protected Set<BeanDefinitionHolder> |
doScan(String... basePackages)
Perform a scan within the specified base packages, returning the registered bean definitions. |
int |
scan(String... basePackages)
Perform a scan within the specified base packages. |
void |
setAutowireCandidatePatterns(String[] autowireCandidatePatterns)
Set the name-matching patterns for determining autowire candidates. |
void |
setBeanDefinitionDefaults(BeanDefinitionDefaults beanDefinitionDefaults)
Set the defaults to use for detected beans. |
void |
setBeanNameGenerator(BeanNameGenerator beanNameGenerator)
Set the BeanNameGenerator to use for detected bean classes. |
void |
setIncludeAnnotationConfig(boolean includeAnnotationConfig)
Specify whether to register annotation config post-processors. |
void |
setScopedProxyMode(ScopedProxyMode scopedProxyMode)
Specify the proxy behavior for non-singleton scoped beans. |
void |
setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver)
Set the ScopeMetadataResolver to use for detected bean classes. |
Methods inherited from class org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider |
---|
addExcludeFilter, addIncludeFilter, findCandidateComponents, isCandidateComponent, isCandidateComponent, registerDefaultFilters, resetFilters, setResourceLoader, setResourcePattern |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry)
registry
- the BeanFactory to load bean definitions into,
in the form of a BeanDefinitionRegistrypublic ClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry, boolean useDefaultFilters)
If the passed-in bean factory does not only implement the BeanDefinitionRegistry
interface but also the ResourceLoader interface, it will be used as default
ResourceLoader as well. This will usually be the case for
ApplicationContext
implementations.
If given a plain BeanDefinitionRegistry, the default ResourceLoader will be a
PathMatchingResourcePatternResolver
.
registry
- the BeanFactory to load bean definitions into,
in the form of a BeanDefinitionRegistryuseDefaultFilters
- whether to include the default filters for the
@Component
,
@Repository
,
@Service
, and
@Controller
stereotype
annotations.ClassPathScanningCandidateComponentProvider.setResourceLoader(org.springframework.core.io.ResourceLoader)
Method Detail |
---|
public void setBeanDefinitionDefaults(BeanDefinitionDefaults beanDefinitionDefaults)
BeanDefinitionDefaults
public void setAutowireCandidatePatterns(String[] autowireCandidatePatterns)
autowireCandidatePatterns
- the patterns to match againstpublic void setBeanNameGenerator(BeanNameGenerator beanNameGenerator)
Default is a AnnotationBeanNameGenerator
.
public void setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver)
The default is an AnnotationScopeMetadataResolver
.
setScopedProxyMode(org.springframework.context.annotation.ScopedProxyMode)
public void setScopedProxyMode(ScopedProxyMode scopedProxyMode)
The default is ScopedProxyMode.NO
.
setScopeMetadataResolver(org.springframework.context.annotation.ScopeMetadataResolver)
public void setIncludeAnnotationConfig(boolean includeAnnotationConfig)
The default is to register the post-processors. Turn this off to be able to ignore the annotations or to process them differently.
public int scan(String... basePackages)
basePackages
- the packages to check for annotated classes
protected Set<BeanDefinitionHolder> doScan(String... basePackages)
This method does not register an annotation config processor but rather leaves this up to the caller.
basePackages
- the packages to check for annotated classes
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |