private class StubWebApplicationContext.StubBeanFactory extends StaticListableBeanFactory implements AutowireCapableBeanFactory
ApplicationContextAware
singletons.AUTOWIRE_AUTODETECT, AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_CONSTRUCTOR, AUTOWIRE_NO
FACTORY_BEAN_PREFIX
Modifier | Constructor and Description |
---|---|
private |
StubWebApplicationContext.StubBeanFactory() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
applyBeanPostProcessorsAfterInitialization(java.lang.Object existingBean,
java.lang.String beanName)
Apply
BeanPostProcessors to the given existing bean
instance, invoking their postProcessAfterInitialization methods. |
java.lang.Object |
applyBeanPostProcessorsBeforeInitialization(java.lang.Object existingBean,
java.lang.String beanName)
Apply
BeanPostProcessors to the given existing bean
instance, invoking their postProcessBeforeInitialization methods. |
void |
applyBeanPropertyValues(java.lang.Object existingBean,
java.lang.String beanName)
Apply the property values of the bean definition with the given name to
the given bean instance.
|
java.lang.Object |
autowire(java.lang.Class beanClass,
int autowireMode,
boolean dependencyCheck)
Instantiate a new bean instance of the given class with the specified autowire
strategy.
|
void |
autowireBean(java.lang.Object existingBean)
Populate the given bean instance through applying after-instantiation callbacks
and bean property post-processing (e.g.
|
void |
autowireBeanProperties(java.lang.Object existingBean,
int autowireMode,
boolean dependencyCheck)
Autowire the bean properties of the given bean instance by name or type.
|
java.lang.Object |
configureBean(java.lang.Object existingBean,
java.lang.String beanName)
Configure the given raw bean: autowiring bean properties, applying
bean property values, applying factory callbacks such as
setBeanName
and setBeanFactory , and also applying all bean post processors
(including ones which might wrap the given raw bean). |
<T> T |
createBean(java.lang.Class<T> beanClass)
Fully create a new bean instance of the given class.
|
java.lang.Object |
createBean(java.lang.Class beanClass,
int autowireMode,
boolean dependencyCheck)
Fully create a new bean instance of the given class with the specified
autowire strategy.
|
java.lang.Object |
initializeBean(java.lang.Object existingBean,
java.lang.String beanName)
Initialize the given raw bean, applying factory callbacks
such as
setBeanName and setBeanFactory ,
also applying all bean post processors (including ones which
might wrap the given raw bean). |
java.lang.Object |
resolveDependency(DependencyDescriptor descriptor,
java.lang.String beanName)
Resolve the specified dependency against the beans defined in this factory.
|
java.lang.Object |
resolveDependency(DependencyDescriptor descriptor,
java.lang.String beanName,
java.util.Set<java.lang.String> autowiredBeanNames,
TypeConverter typeConverter)
Resolve the specified dependency against the beans defined in this factory.
|
addBean, containsBean, containsBeanDefinition, findAnnotationOnBean, getAliases, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getType, isPrototype, isSingleton, isTypeMatch
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
containsBean, getAliases, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch
private StubWebApplicationContext.StubBeanFactory()
public java.lang.Object initializeBean(java.lang.Object existingBean, java.lang.String beanName) throws BeansException
AutowireCapableBeanFactory
setBeanName
and setBeanFactory
,
also applying all bean post processors (including ones which
might wrap the given raw bean).
Note that no bean definition of the given name has to exist in the bean factory. The passed-in bean name will simply be used for callbacks but not checked against the registered bean definitions.
initializeBean
in interface AutowireCapableBeanFactory
existingBean
- the existing bean instancebeanName
- the name of the bean, to be passed to it if necessary
(only passed to BeanPostProcessors
)BeansException
- if the initialization failedpublic <T> T createBean(java.lang.Class<T> beanClass) throws BeansException
AutowireCapableBeanFactory
Performs full initialization of the bean, including all applicable
BeanPostProcessors
.
Note: This is intended for creating a fresh instance, populating annotated
fields and methods as well as applying all standard bean initialiation callbacks.
It does not> imply traditional by-name or by-type autowiring of properties;
use AutowireCapableBeanFactory.createBean(Class, int, boolean)
for that purposes.
createBean
in interface AutowireCapableBeanFactory
beanClass
- the class of the bean to createBeansException
- if instantiation or wiring failedpublic java.lang.Object createBean(java.lang.Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException
AutowireCapableBeanFactory
Performs full initialization of the bean, including all applicable
BeanPostProcessors
. This is effectively a superset
of what AutowireCapableBeanFactory.autowire(java.lang.Class<?>, int, boolean)
provides, adding AutowireCapableBeanFactory.initializeBean(java.lang.Object, java.lang.String)
behavior.
createBean
in interface AutowireCapableBeanFactory
beanClass
- the class of the bean to createautowireMode
- by name or type, using the constants in this interfacedependencyCheck
- whether to perform a dependency check for objects
(not applicable to autowiring a constructor, thus ignored there)BeansException
- if instantiation or wiring failedAutowireCapableBeanFactory.AUTOWIRE_NO
,
AutowireCapableBeanFactory.AUTOWIRE_BY_NAME
,
AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE
,
AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR
public java.lang.Object autowire(java.lang.Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException
AutowireCapableBeanFactory
AUTOWIRE_NO
in order to just apply
before-instantiation callbacks (e.g. for annotation-driven injection).
Does not apply standard BeanPostProcessors
callbacks or perform any further initialization of the bean. This interface
offers distinct, fine-grained operations for those purposes, for example
AutowireCapableBeanFactory.initializeBean(java.lang.Object, java.lang.String)
. However, InstantiationAwareBeanPostProcessor
callbacks are applied, if applicable to the construction of the instance.
autowire
in interface AutowireCapableBeanFactory
beanClass
- the class of the bean to instantiateautowireMode
- by name or type, using the constants in this interfacedependencyCheck
- whether to perform a dependency check for object
references in the bean instance (not applicable to autowiring a constructor,
thus ignored there)BeansException
- if instantiation or wiring failedAutowireCapableBeanFactory.AUTOWIRE_NO
,
AutowireCapableBeanFactory.AUTOWIRE_BY_NAME
,
AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE
,
AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR
,
AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT
,
AutowireCapableBeanFactory.initializeBean(java.lang.Object, java.lang.String)
,
AutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(java.lang.Object, java.lang.String)
,
AutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(java.lang.Object, java.lang.String)
public void autowireBean(java.lang.Object existingBean) throws BeansException
AutowireCapableBeanFactory
Note: This is essentially intended for (re-)populating annotated fields and
methods, either for new instances or for deserialized instances. It does
not imply traditional by-name or by-type autowiring of properties;
use AutowireCapableBeanFactory.autowireBeanProperties(java.lang.Object, int, boolean)
for that purposes.
autowireBean
in interface AutowireCapableBeanFactory
existingBean
- the existing bean instanceBeansException
- if wiring failedpublic void autowireBeanProperties(java.lang.Object existingBean, int autowireMode, boolean dependencyCheck) throws BeansException
AutowireCapableBeanFactory
AUTOWIRE_NO
in order to just apply
after-instantiation callbacks (e.g. for annotation-driven injection).
Does not apply standard BeanPostProcessors
callbacks or perform any further initialization of the bean. This interface
offers distinct, fine-grained operations for those purposes, for example
AutowireCapableBeanFactory.initializeBean(java.lang.Object, java.lang.String)
. However, InstantiationAwareBeanPostProcessor
callbacks are applied, if applicable to the configuration of the instance.
autowireBeanProperties
in interface AutowireCapableBeanFactory
existingBean
- the existing bean instanceautowireMode
- by name or type, using the constants in this interfacedependencyCheck
- whether to perform a dependency check for object
references in the bean instanceBeansException
- if wiring failedAutowireCapableBeanFactory.AUTOWIRE_BY_NAME
,
AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE
,
AutowireCapableBeanFactory.AUTOWIRE_NO
public java.lang.Object configureBean(java.lang.Object existingBean, java.lang.String beanName) throws BeansException
AutowireCapableBeanFactory
setBeanName
and setBeanFactory
, and also applying all bean post processors
(including ones which might wrap the given raw bean).
This is effectively a superset of what AutowireCapableBeanFactory.initializeBean(java.lang.Object, java.lang.String)
provides,
fully applying the configuration specified by the corresponding bean definition.
Note: This method requires a bean definition for the given name!
configureBean
in interface AutowireCapableBeanFactory
existingBean
- the existing bean instancebeanName
- the name of the bean, to be passed to it if necessary
(a bean definition of that name has to be available)NoSuchBeanDefinitionException
- if there is no bean definition with the given nameBeansException
- if the initialization failedAutowireCapableBeanFactory.initializeBean(java.lang.Object, java.lang.String)
public java.lang.Object resolveDependency(DependencyDescriptor descriptor, java.lang.String beanName) throws BeansException
AutowireCapableBeanFactory
resolveDependency
in interface AutowireCapableBeanFactory
descriptor
- the descriptor for the dependencybeanName
- the name of the bean which declares the present dependencynull
if none foundBeansException
- in dependency resolution failedpublic java.lang.Object resolveDependency(DependencyDescriptor descriptor, java.lang.String beanName, java.util.Set<java.lang.String> autowiredBeanNames, TypeConverter typeConverter) throws BeansException
AutowireCapableBeanFactory
resolveDependency
in interface AutowireCapableBeanFactory
descriptor
- the descriptor for the dependencybeanName
- the name of the bean which declares the present dependencyautowiredBeanNames
- a Set that all names of autowired beans (used for
resolving the present dependency) are supposed to be added totypeConverter
- the TypeConverter to use for populating arrays and
collectionsnull
if none foundBeansException
- in dependency resolution failedpublic void applyBeanPropertyValues(java.lang.Object existingBean, java.lang.String beanName) throws BeansException
AutowireCapableBeanFactory
This method does not autowire bean properties; it just applies
explicitly defined property values. Use the AutowireCapableBeanFactory.autowireBeanProperties(java.lang.Object, int, boolean)
method to autowire an existing bean instance.
Note: This method requires a bean definition for the given name!
Does not apply standard BeanPostProcessors
callbacks or perform any further initialization of the bean. This interface
offers distinct, fine-grained operations for those purposes, for example
AutowireCapableBeanFactory.initializeBean(java.lang.Object, java.lang.String)
. However, InstantiationAwareBeanPostProcessor
callbacks are applied, if applicable to the configuration of the instance.
applyBeanPropertyValues
in interface AutowireCapableBeanFactory
existingBean
- the existing bean instancebeanName
- the name of the bean definition in the bean factory
(a bean definition of that name has to be available)NoSuchBeanDefinitionException
- if there is no bean definition with the given nameBeansException
- if applying the property values failedAutowireCapableBeanFactory.autowireBeanProperties(java.lang.Object, int, boolean)
public java.lang.Object applyBeanPostProcessorsBeforeInitialization(java.lang.Object existingBean, java.lang.String beanName) throws BeansException
AutowireCapableBeanFactory
BeanPostProcessors
to the given existing bean
instance, invoking their postProcessBeforeInitialization
methods.
The returned bean instance may be a wrapper around the original.applyBeanPostProcessorsBeforeInitialization
in interface AutowireCapableBeanFactory
existingBean
- the new bean instancebeanName
- the name of the beanBeansException
- if any post-processing failedBeanPostProcessor.postProcessBeforeInitialization(java.lang.Object, java.lang.String)
public java.lang.Object applyBeanPostProcessorsAfterInitialization(java.lang.Object existingBean, java.lang.String beanName) throws BeansException
AutowireCapableBeanFactory
BeanPostProcessors
to the given existing bean
instance, invoking their postProcessAfterInitialization
methods.
The returned bean instance may be a wrapper around the original.applyBeanPostProcessorsAfterInitialization
in interface AutowireCapableBeanFactory
existingBean
- the new bean instancebeanName
- the name of the beanBeansException
- if any post-processing failedBeanPostProcessor.postProcessAfterInitialization(java.lang.Object, java.lang.String)