Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » aop » target » [javadoc | source]
org.springframework.aop.target
abstract public class: AbstractBeanFactoryBasedTargetSource [javadoc | source]
java.lang.Object
   org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource

All Implemented Interfaces:
    TargetSource, BeanFactoryAware, Serializable

Direct Known Subclasses:
    LazyInitTargetSource, SimpleBeanTargetSource, CommonsPoolTargetSource, PrototypeTargetSource, AbstractPoolingTargetSource, AbstractPrototypeBasedTargetSource, NotificationPublisherAwareLazyTargetSource, ThreadLocalTargetSource

Base class for org.springframework.aop.TargetSource implementations that are based on a Spring org.springframework.beans.factory.BeanFactory , delegating to Spring-managed bean instances.

Subclasses can create prototype instances or lazily access a singleton target, for example. See LazyInitTargetSource and AbstractPrototypeBasedTargetSource 's subclasses for concrete strategies.

BeanFactory-based TargetSources are serializable. This involves disconnecting the current target and turning into a SingletonTargetSource .

Field Summary
protected final  Log logger    Logger available to subclasses 
Method from org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource Summary:
copyFrom,   equals,   getBeanFactory,   getTargetBeanName,   getTargetClass,   hashCode,   isStatic,   releaseTarget,   setBeanFactory,   setTargetBeanName,   setTargetClass,   toString,   writeReplace
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource Detail:
 protected  void copyFrom(AbstractBeanFactoryBasedTargetSource other) 
    Copy configuration from the other AbstractBeanFactoryBasedTargetSource object. Subclasses should override this if they wish to expose it.
 public boolean equals(Object other) 
 public BeanFactory getBeanFactory() 
    Return the owning BeanFactory.
 public String getTargetBeanName() 
    Return the name of the target bean in the factory.
 public synchronized Class getTargetClass() 
 public int hashCode() 
 public boolean isStatic() 
 public  void releaseTarget(Object target) throws Exception 
 public  void setBeanFactory(BeanFactory beanFactory) throws BeansException 
    Set the owning BeanFactory. We need to save a reference so that we can use the getBean method on every invocation.
 public  void setTargetBeanName(String targetBeanName) 
    Set the name of the target bean in the factory.

    The target bean should not be a singleton, else the same instance will always be obtained from the factory, resulting in the same behavior as provided by SingletonTargetSource .

 public  void setTargetClass(Class targetClass) 
    Specify the target class explicitly, to avoid any kind of access to the target bean (for example, to avoid initialization of a FactoryBean instance).

    Default is to detect the type automatically, through a getType call on the BeanFactory (or even a full getBean call as fallback).

 public String toString() 
 protected Object writeReplace() throws ObjectStreamException 
    Replaces this object with a SingletonTargetSource on serialization. Protected as otherwise it won't be invoked for subclasses. (The writeReplace() method must be visible to the class being serialized.)

    With this implementation of this method, there is no need to mark non-serializable fields in this class or subclasses as transient.