|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.core.SimpleAliasRegistry
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
org.springframework.beans.factory.support.FactoryBeanRegistrySupport
public abstract class FactoryBeanRegistrySupport
Support base class for singleton registries which need to handle
FactoryBean
instances,
integrated with DefaultSingletonBeanRegistry
's singleton management.
Serves as base class for AbstractBeanFactory
.
Field Summary | |
---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
factoryBeanObjectCache
Cache of singleton objects created by FactoryBeans: FactoryBean name --> object |
Fields inherited from class org.springframework.beans.factory.support.DefaultSingletonBeanRegistry |
---|
logger, NULL_OBJECT |
Constructor Summary | |
---|---|
FactoryBeanRegistrySupport()
|
Method Summary | |
---|---|
private java.lang.Object |
doGetObjectFromFactoryBean(FactoryBean factory,
java.lang.String beanName,
boolean shouldPostProcess)
Obtain an object to expose from the given FactoryBean. |
protected java.security.AccessControlContext |
getAccessControlContext()
Returns the security context for this bean factory. |
protected java.lang.Object |
getCachedObjectForFactoryBean(java.lang.String beanName)
Obtain an object to expose from the given FactoryBean, if available in cached form. |
protected FactoryBean |
getFactoryBean(java.lang.String beanName,
java.lang.Object beanInstance)
Get a FactoryBean for the given bean if possible. |
protected java.lang.Object |
getObjectFromFactoryBean(FactoryBean factory,
java.lang.String beanName,
boolean shouldPostProcess)
Obtain an object to expose from the given FactoryBean. |
protected java.lang.Class |
getTypeForFactoryBean(FactoryBean factoryBean)
Determine the type for the given FactoryBean. |
protected java.lang.Object |
postProcessObjectFromFactoryBean(java.lang.Object object,
java.lang.String beanName)
Post-process the given object that has been obtained from the FactoryBean. |
protected void |
removeSingleton(java.lang.String beanName)
Overridden to clear the FactoryBean object cache as well. |
Methods inherited from class org.springframework.beans.factory.support.DefaultSingletonBeanRegistry |
---|
addSingleton, addSingletonFactory, afterSingletonCreation, beforeSingletonCreation, containsSingleton, destroyBean, destroySingleton, destroySingletons, getDependenciesForBean, getDependentBeans, getSingleton, getSingleton, getSingleton, getSingletonCount, getSingletonMutex, getSingletonNames, hasDependentBean, isSingletonCurrentlyInCreation, onSuppressedException, registerContainedBean, registerDependentBean, registerDisposableBean, registerSingleton, setCurrentlyInCreation |
Methods inherited from class org.springframework.core.SimpleAliasRegistry |
---|
allowAliasOverriding, canonicalName, checkForAliasCircle, getAliases, isAlias, registerAlias, removeAlias, resolveAliases |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.util.Map<java.lang.String,java.lang.Object> factoryBeanObjectCache
Constructor Detail |
---|
public FactoryBeanRegistrySupport()
Method Detail |
---|
protected java.lang.Class getTypeForFactoryBean(FactoryBean factoryBean)
factoryBean
- the FactoryBean instance to check
null
if the type cannot be determined yetprotected java.lang.Object getCachedObjectForFactoryBean(java.lang.String beanName)
beanName
- the name of the bean
null
if not availableprotected java.lang.Object getObjectFromFactoryBean(FactoryBean factory, java.lang.String beanName, boolean shouldPostProcess)
factory
- the FactoryBean instancebeanName
- the name of the beanshouldPostProcess
- whether the bean is subject for post-processing
BeanCreationException
- if FactoryBean object creation failedFactoryBean.getObject()
private java.lang.Object doGetObjectFromFactoryBean(FactoryBean factory, java.lang.String beanName, boolean shouldPostProcess) throws BeanCreationException
factory
- the FactoryBean instancebeanName
- the name of the beanshouldPostProcess
- whether the bean is subject for post-processing
BeanCreationException
- if FactoryBean object creation failedFactoryBean.getObject()
protected java.lang.Object postProcessObjectFromFactoryBean(java.lang.Object object, java.lang.String beanName) throws BeansException
The default implementation simply returns the given object as-is. Subclasses may override this, for example, to apply post-processors.
object
- the object obtained from the FactoryBean.beanName
- the name of the bean
BeansException
- if any post-processing failedprotected FactoryBean getFactoryBean(java.lang.String beanName, java.lang.Object beanInstance) throws BeansException
beanName
- the name of the beanbeanInstance
- the corresponding bean instance
BeansException
- if the given bean cannot be exposed as a FactoryBeanprotected void removeSingleton(java.lang.String beanName)
removeSingleton
in class DefaultSingletonBeanRegistry
beanName
- the name of the beanDefaultSingletonBeanRegistry.getSingletonMutex()
protected java.security.AccessControlContext getAccessControlContext()
AccessController.getContext()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |