spring-aop

org.springframework.aop.scope
Class ScopedProxyFactoryBean

java.lang.Object
  extended by org.springframework.aop.framework.ProxyConfig
      extended by org.springframework.aop.scope.ScopedProxyFactoryBean
All Implemented Interfaces:
java.io.Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.FactoryBean<java.lang.Object>

public class ScopedProxyFactoryBean
extends ProxyConfig
implements org.springframework.beans.factory.FactoryBean<java.lang.Object>, org.springframework.beans.factory.BeanFactoryAware

Convenient proxy factory bean for scoped objects.

Proxies created using this factory bean are thread-safe singletons and may be injected into shared objects, with transparent scoping behavior.

Proxies returned by this class implement the ScopedObject interface. This presently allows for removing the corresponding object from the scope, seamlessly creating a new instance in the scope on next access.

Please note that the proxies created by this factory are class-based proxies by default. This can be customized through switching the "proxyTargetClass" property to "false".

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller
See Also:
ProxyConfig.setProxyTargetClass(boolean), Serialized Form

Constructor Summary
ScopedProxyFactoryBean()
          Create a new ScopedProxyFactoryBean instance.
 
Method Summary
 java.lang.Object getObject()
           
 java.lang.Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setTargetBeanName(java.lang.String targetBeanName)
          Set the name of the bean that is to be scoped.
 
Methods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScopedProxyFactoryBean

public ScopedProxyFactoryBean()
Create a new ScopedProxyFactoryBean instance.

Method Detail

setTargetBeanName

public void setTargetBeanName(java.lang.String targetBeanName)
Set the name of the bean that is to be scoped.


setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware

getObject

public java.lang.Object getObject()
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>

getObjectType

public java.lang.Class<?> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>

spring-aop