open class ClassPathBeanDefinitionScanner : ClassPathScanningCandidateComponentProvider
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 org.springframework.stereotype.Component, org.springframework.stereotype.Repository, org.springframework.stereotype.Service, or org.springframework.stereotype.Controller stereotype.
Also supports Java EE 6's javax.annotation.ManagedBean and JSR-330's javax.inject.Named annotations, if available.
Author
Mark Fisher
Author
Juergen Hoeller
Author
Chris Beams
Since
2.5
See Also
AnnotationConfigApplicationContext#scanorg.springframework.stereotype.Componentorg.springframework.stereotype.Repositoryorg.springframework.stereotype.Serviceorg.springframework.stereotype.Controller
ClassPathBeanDefinitionScanner(registry: BeanDefinitionRegistry)
Create a new ClassPathBeanDefinitionScanner(registry: BeanDefinitionRegistry, useDefaultFilters: Boolean)
Create a new If the passed-in bean factory does not only implement the If given a plain If the passed-in bean factory also implements EnvironmentCapable its environment will be used by this reader. Otherwise, the reader will initialize and use a org.springframework.core.env.StandardEnvironment. All ClassPathBeanDefinitionScanner(registry: BeanDefinitionRegistry, useDefaultFilters: Boolean, environment: Environment)
Create a new If the passed-in bean factory does not only implement the If given a plain ClassPathBeanDefinitionScanner(registry: BeanDefinitionRegistry, useDefaultFilters: Boolean, environment: Environment, resourceLoader: ResourceLoader)
Create a new |
open fun getBeanDefinitionDefaults(): BeanDefinitionDefaults
Return the defaults to use for detected beans (never |
|
fun getRegistry(): BeanDefinitionRegistry
Return the BeanDefinitionRegistry that this scanner operates on. |
|
open fun scan(vararg basePackages: String): Int
Perform a scan within the specified base packages. |
|
open fun setAutowireCandidatePatterns(vararg autowireCandidatePatterns: String): Unit
Set the name-matching patterns for determining autowire candidates. |
|
open fun setBeanDefinitionDefaults(beanDefinitionDefaults: BeanDefinitionDefaults): Unit
Set the defaults to use for detected beans. |
|
open fun setBeanNameGenerator(beanNameGenerator: BeanNameGenerator): Unit
Set the BeanNameGenerator to use for detected bean classes. Default is a AnnotationBeanNameGenerator. |
|
open fun setIncludeAnnotationConfig(includeAnnotationConfig: Boolean): Unit
Specify whether to register annotation config post-processors. The default is to register the post-processors. Turn this off to be able to ignore the annotations or to process them differently. |
|
open fun setScopeMetadataResolver(scopeMetadataResolver: ScopeMetadataResolver): Unit
Set the ScopeMetadataResolver to use for detected bean classes. Note that this will override any custom "scopedProxyMode" setting. The default is an AnnotationScopeMetadataResolver. |
|
open fun setScopedProxyMode(scopedProxyMode: ScopedProxyMode): Unit
Specify the proxy behavior for non-singleton scoped beans. Note that this will override any custom "scopeMetadataResolver" setting. The default is |