站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.1.0 API 文档英文版

BeanConfigurerSupport (Spring Framework API 2.1) - Spring Framework 2.1.0 API 文档英文版


The Spring Framework

org.springframework.beans.factory.wiring
Class BeanConfigurerSupport

java.lang.Object
  extended by org.springframework.beans.factory.wiring.BeanConfigurerSupport
All Implemented Interfaces:
BeanFactoryAware, DisposableBean, InitializingBean

public abstract class BeanConfigurerSupport
extends Object
implements BeanFactoryAware, InitializingBean, DisposableBean

Convenient superclass for configurers that can perform Dependency Injection on objects (however they may be created).

Typically subclassed by AspectJ aspects.

Subclasses may also need a 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.)

Since:
2.0
Author:
Rob Harrop, Rod Johnson, Juergen Hoeller, Adrian Colyer

Field Summary
protected  Log logger
          Logger available to subclasses
 
Constructor Summary
BeanConfigurerSupport()
           
 
Method Summary
 void afterPropertiesSet()
          If no BeanWiringInfoResolver was provided, use a ClassNameBeanWiringInfoResolver as the default.
protected  void configureBean(Object beanInstance)
          Configure the bean instance.
 void destroy()
          Release references to the BeanFactory and BeanWiringInfoResolver when the container is destroyed.
 void setBeanFactory(BeanFactory beanFactory)
          Set the BeanFactory in which this aspect must configure beans.
 void setBeanWiringInfoResolver(BeanWiringInfoResolver beanWiringInfoResolver)
          Set the BeanWiringInfoResolver to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Log logger
Logger available to subclasses

Constructor Detail

BeanConfigurerSupport

public BeanConfigurerSupport()
Method Detail

setBeanWiringInfoResolver

public void setBeanWiringInfoResolver(BeanWiringInfoResolver beanWiringInfoResolver)
Set the BeanWiringInfoResolver to use.

Default behavior will be to look for a bean with the same name as the class.

As an alternative, consider using annotation-driven bean wiring.

Parameters:
beanWiringInfoResolver - the BeanWiringInfoResolver to use.
See Also:
ClassNameBeanWiringInfoResolver, AnnotationBeanWiringInfoResolver

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
Set the BeanFactory in which this aspect must configure beans.

Specified by:
setBeanFactory in interface BeanFactoryAware
Parameters:
beanFactory - owning BeanFactory (never null). The bean can immediately call methods on the factory.
Throws:
IllegalArgumentException - if the supplied beanFactory is not an AutowireCapableBeanFactory.
See Also:
BeanInitializationException

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
If no BeanWiringInfoResolver was provided, use a ClassNameBeanWiringInfoResolver as the default.

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails.

destroy

public void destroy()
Release references to the BeanFactory and BeanWiringInfoResolver when the container is destroyed.

Specified by:
destroy in interface DisposableBean

configureBean

protected 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 - the bean instance to configure (must not be null)

The Spring Framework

Copyright © 2002-2007 The Spring Framework.