Top Description Fields Constructors Methods
org.springframework.beans.factory.wiring

public Class BeanConfigurerSupport

extends Object
implements BeanFactoryAware, InitializingBean, DisposableBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.Aware
Imports
org.apache.commons.logging.Log, .LogFactory, org.springframework.beans.factory.BeanCreationException, .BeanCurrentlyInCreationException, .BeanFactory, .BeanFactoryAware, .DisposableBean, .InitializingBean, org.springframework.beans.factory.config.ConfigurableListableBeanFactory, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils

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.)

Authors
Rob Harrop, Rod Johnson, Juergen Hoeller, Adrian Colyer
Since
2.0
See Also
setBeanWiringInfoResolver, ClassNameBeanWiringInfoResolver

Field Summary

Modifier and TypeField and Description
private volatile ConfigurableListableBeanFactory
private volatile BeanWiringInfoResolver
protected final Log
logger

Logger available to subclasses.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
configureBean(Object
the bean instance to configure (must not be null)
beanInstance
)

Configure the bean instance.

protected BeanWiringInfoResolver

Returns:

the default BeanWiringInfoResolver (never null)
createDefaultBeanWiringInfoResolver
()

Create the default BeanWiringInfoResolver to be used if none was specified explicitly.

public void
destroy()

Implements org.springframework.beans.factory.DisposableBean.destroy.

Release references to the BeanFactory and BeanWiringInfoResolver when the container is destroyed.
public void
setBeanFactory(BeanFactory
owning BeanFactory (never null). The bean can immediately call methods on the factory.
beanFactory
)

Implements org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Set the BeanFactory in which this aspect must configure beans.
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beanFactoryback to summary
private volatile ConfigurableListableBeanFactory beanFactory
Annotations
@Nullable
beanWiringInfoResolverback to summary
private volatile BeanWiringInfoResolver beanWiringInfoResolver
Annotations
@Nullable
loggerback to summary
protected final Log logger

Logger available to subclasses.

Constructor Detail

BeanConfigurerSupportback to summary
public BeanConfigurerSupport()

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Check that a BeanFactory has been set.

Annotations
@Override
configureBeanback to summary
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.

Parameters
beanInstance:Object

the bean instance to configure (must not be null)

createDefaultBeanWiringInfoResolverback to summary
protected BeanWiringInfoResolver createDefaultBeanWiringInfoResolver()

Create the default BeanWiringInfoResolver to be used if none was specified explicitly.

The default implementation builds a ClassNameBeanWiringInfoResolver.

Returns:BeanWiringInfoResolver

the default BeanWiringInfoResolver (never null)

Annotations
@Nullable
destroyback to summary
public void destroy()

Implements org.springframework.beans.factory.DisposableBean.destroy.

Release references to the BeanFactory and BeanWiringInfoResolver when the container is destroyed.

Annotations
@Override
setBeanFactoryback to summary
public void setBeanFactory(BeanFactory beanFactory)

Implements org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Set the BeanFactory in which this aspect must configure beans.

Parameters
beanFactory:BeanFactory

Doc from org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

owning BeanFactory (never null). The bean can immediately call methods on the factory.

Annotations
@Override
setBeanWiringInfoResolverback to summary
public void setBeanWiringInfoResolver(BeanWiringInfoResolver beanWiringInfoResolver)

Set the BeanWiringInfoResolver 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.

See Also
ClassNameBeanWiringInfoResolver, org.springframework.beans.factory.annotation.AnnotationBeanWiringInfoResolver