Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » beans » factory » config » [javadoc | source]
org.springframework.beans.factory.config
public class: BeanReferenceFactoryBean [javadoc | source]
java.lang.Object
   org.springframework.beans.factory.config.BeanReferenceFactoryBean

All Implemented Interfaces:
    SmartFactoryBean, BeanFactoryAware

FactoryBean that exposes an arbitrary target bean under a different name.

Usually, the target bean will reside in a different bean definition file, using this FactoryBean to link it in and expose it under a different name. Effectively, this corresponds to an alias for the target bean.

NOTE: For XML bean definition files, an <alias> tag is available that effectively achieves the same.

A special capability of this FactoryBean is enabled through its configuration as bean definition: The "targetBeanName" can be substituted through a placeholder, in combination with Spring's PropertyPlaceholderConfigurer . Thanks to Marcus Bristav for pointing this out!

Method from org.springframework.beans.factory.config.BeanReferenceFactoryBean Summary:
getObject,   getObjectType,   isEagerInit,   isPrototype,   isSingleton,   setBeanFactory,   setTargetBeanName
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.beans.factory.config.BeanReferenceFactoryBean Detail:
 public Object getObject() throws BeansException 
 public Class getObjectType() 
 public boolean isEagerInit() 
 public boolean isPrototype() 
 public boolean isSingleton() 
 public  void setBeanFactory(BeanFactory beanFactory) 
 public  void setTargetBeanName(String targetBeanName) 
    Set the name of the target bean.

    This property is required. The value for this property can be substituted through a placeholder, in combination with Spring's PropertyPlaceholderConfigurer.