类 BeanConfigurerSupport
- java.lang.Object
- org.springframework.beans.factory.wiring.BeanConfigurerSupport
- 所有已实现的接口:
Aware
,BeanFactoryAware
,DisposableBean
,InitializingBean
public class BeanConfigurerSupport extends Object implements BeanFactoryAware, InitializingBean, DisposableBean
Convenient base class for bean configurers that can perform Dependency Injection on objects (however they may be created). Typically subclassed by AspectJ aspects.Subclasses may also need a custom metadata resolution strategy, in the
BeanWiringInfoResolver
interface. The default implementation looks for a bean with the same name as the fully-qualified class name. (This is the default name of the bean in a Spring XML file if the 'id
' attribute is not used.)- 从以下版本开始:
- 2.0
- 作者:
- Rob Harrop, Rod Johnson, Juergen Hoeller, Adrian Colyer
- 另请参阅:
setBeanWiringInfoResolver(org.springframework.beans.factory.wiring.BeanWiringInfoResolver)
,ClassNameBeanWiringInfoResolver
构造器概要
构造器 构造器 说明 BeanConfigurerSupport()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Check that aBeanFactory
has been set.void
configureBean(Object beanInstance)
Configure the bean instance.protected BeanWiringInfoResolver
createDefaultBeanWiringInfoResolver()
Create the default BeanWiringInfoResolver to be used if none was specified explicitly.void
destroy()
Release references to theBeanFactory
andBeanWiringInfoResolver
when the container is destroyed.void
setBeanFactory(BeanFactory beanFactory)
Set theBeanFactory
in which this aspect must configure beans.void
setBeanWiringInfoResolver(BeanWiringInfoResolver beanWiringInfoResolver)
Set theBeanWiringInfoResolver
to use.
构造器详细资料
BeanConfigurerSupport
public BeanConfigurerSupport()
方法详细资料
setBeanWiringInfoResolver
public void setBeanWiringInfoResolver(BeanWiringInfoResolver beanWiringInfoResolver)
Set theBeanWiringInfoResolver
to use.The default behavior is to look for a bean with the same name as the class. As an alternative, consider using annotation-driven bean wiring.
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
Set theBeanFactory
in which this aspect must configure beans.- 指定者:
setBeanFactory
在接口中BeanFactoryAware
- 参数:
beanFactory
- owning BeanFactory (nevernull
). The bean can immediately call methods on the factory.- 另请参阅:
BeanInitializationException
createDefaultBeanWiringInfoResolver
@Nullable protected BeanWiringInfoResolver createDefaultBeanWiringInfoResolver()
Create the default BeanWiringInfoResolver to be used if none was specified explicitly.The default implementation builds a
ClassNameBeanWiringInfoResolver
.- 返回:
- the default BeanWiringInfoResolver (never
null
)
afterPropertiesSet
public void afterPropertiesSet()
Check that aBeanFactory
has been set.- 指定者:
afterPropertiesSet
在接口中InitializingBean
destroy
public void destroy()
Release references to theBeanFactory
andBeanWiringInfoResolver
when the container is destroyed.- 指定者:
destroy
在接口中DisposableBean
configureBean
public void configureBean(Object beanInstance)
Configure the bean instance.Subclasses can override this to provide custom configuration logic. Typically called by an aspect, for all bean instances matched by a pointcut.
- 参数:
beanInstance
- the bean instance to configure (must not benull
)