Class ScopedProxyFactoryBean

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

public class ScopedProxyFactoryBean extends ProxyConfig implements org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.BeanFactoryAware, AopInfrastructureBean
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:
  • Constructor Details

    • ScopedProxyFactoryBean

      public ScopedProxyFactoryBean()
      Create a new ScopedProxyFactoryBean instance.
  • Method Details

    • setTargetBeanName

      public void setTargetBeanName(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 Object getObject()
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<Object>
    • getObjectType

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

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