Package org.springframework.aop.scope
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:
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>
boolean
void
setBeanFactory
(org.springframework.beans.factory.BeanFactory beanFactory) void
setTargetBeanName
(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
-
Constructor Details
-
ScopedProxyFactoryBean
public ScopedProxyFactoryBean()Create a new ScopedProxyFactoryBean instance.
-
-
Method Details
-
setTargetBeanName
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 interfaceorg.springframework.beans.factory.BeanFactoryAware
-
getObject
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<Object>
-
getObjectType
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<Object>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<Object>
-