|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.context.annotation.AnnotatedBeanDefinitionReader
public class AnnotatedBeanDefinitionReader
Convenient adapter for programmatic registration of annotated bean classes.
This is an alternative to ClassPathBeanDefinitionScanner
, applying
the same resolution of annotations but for explicitly registered classes only.
AnnotationConfigApplicationContext.register(java.lang.Class>...)
Constructor Summary | |
---|---|
AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry)
Create a new AnnotatedBeanDefinitionReader for the given registry. |
|
AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry,
Environment environment)
Create a new AnnotatedBeanDefinitionReader for the given registry and using
the given Environment . |
Method Summary | |
---|---|
BeanDefinitionRegistry |
getRegistry()
Return the BeanDefinitionRegistry that this scanner operates on. |
void |
register(Class<?>... annotatedClasses)
|
void |
registerBean(Class<?> annotatedClass)
|
void |
registerBean(Class<?> annotatedClass,
Class<? extends Annotation>... qualifiers)
|
void |
registerBean(Class<?> annotatedClass,
String name,
Class<? extends Annotation>... qualifiers)
|
void |
setBeanNameGenerator(BeanNameGenerator beanNameGenerator)
Set the BeanNameGenerator to use for detected bean classes. |
void |
setEnvironment(Environment environment)
Set the Environment to use when evaluating whether @Profile -annotated component classes should be registered. |
void |
setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver)
Set the ScopeMetadataResolver to use for detected bean classes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry)
AnnotatedBeanDefinitionReader
for the given registry.
If the registry is EnvironmentCapable
, e.g. is an ApplicationContext
,
the Environment
will be inherited, otherwise a new
StandardEnvironment
will be created and used.
registry
- the BeanFactory
to load bean definitions into,
in the form of a BeanDefinitionRegistry
AnnotatedBeanDefinitionReader(BeanDefinitionRegistry, Environment)
,
setEnvironment(Environment)
public AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry, Environment environment)
AnnotatedBeanDefinitionReader
for the given registry and using
the given Environment
.
registry
- the BeanFactory
to load bean definitions into,
in the form of a BeanDefinitionRegistry
environment
- the Environment
to use when evaluating bean definition
profiles.Method Detail |
---|
public final BeanDefinitionRegistry getRegistry()
public void setEnvironment(Environment environment)
@Profile
-annotated component classes should be registered.
The default is a StandardEnvironment
.
registerBean(Class, String, Class...)
public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator)
The default is a AnnotationBeanNameGenerator
.
public void setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver)
The default is an AnnotationScopeMetadataResolver
.
public void register(Class<?>... annotatedClasses)
public void registerBean(Class<?> annotatedClass)
public void registerBean(Class<?> annotatedClass, Class<? extends Annotation>... qualifiers)
public void registerBean(Class<?> annotatedClass, String name, Class<? extends Annotation>... qualifiers)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |