Top Description Fields Constructors Methods
org.springframework.aop.scope

public abstract Class ScopedProxyUtils

extends Object
Class Inheritance
Imports
org.springframework.aop.framework.autoproxy.AutoProxyUtils, org.springframework.beans.factory.config.BeanDefinition, .BeanDefinitionHolder, org.springframework.beans.factory.support.AbstractBeanDefinition, .BeanDefinitionRegistry, .RootBeanDefinition, org.springframework.lang.Nullable, org.springframework.util.Assert

Utility class for creating a scoped proxy.

Used by ScopedProxyBeanDefinitionDecorator and ClassPathBeanDefinitionScanner.

Authors
Mark Fisher, Juergen Hoeller, Rob Harrop, Sam Brannen
Since
2.5

Field Summary

Modifier and TypeField and Description
private static final String
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static BeanDefinitionHolder

Returns:

the scoped proxy definition
createScopedProxy
(BeanDefinitionHolder
the original bean definition
definition
,
BeanDefinitionRegistry
the bean definition registry
registry
,
boolean
whether to create a target class proxy
proxyTargetClass
)

Generate a scoped proxy for the supplied target bean, registering the target bean with an internal name and setting 'targetBeanName' on the scoped proxy.

public static String

Returns:

the original bean name
getOriginalBeanName
(String
the target bean name for the scoped proxy
targetBeanName
)

Get the original bean name for the provided target bean name.

public static String

Returns:

the generated bean to be used to reference the target bean
getTargetBeanName
(String
the original name of bean
originalBeanName
)

Generate the bean name that is used within the scoped proxy to reference the target bean.

public static boolean
isScopedTarget(String beanName)

Determine if the beanName is the name of a bean that references the target bean within a scoped proxy.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

TARGET_NAME_PREFIXback to summary
private static final String TARGET_NAME_PREFIX
TARGET_NAME_PREFIX_LENGTHback to summary
private static final int TARGET_NAME_PREFIX_LENGTH

Constructor Detail

ScopedProxyUtilsback to summary
public ScopedProxyUtils()

Method Detail

createScopedProxyback to summary
public static BeanDefinitionHolder createScopedProxy(BeanDefinitionHolder definition, BeanDefinitionRegistry registry, boolean proxyTargetClass)

Generate a scoped proxy for the supplied target bean, registering the target bean with an internal name and setting 'targetBeanName' on the scoped proxy.

Parameters
definition:BeanDefinitionHolder

the original bean definition

registry:BeanDefinitionRegistry

the bean definition registry

proxyTargetClass:boolean

whether to create a target class proxy

Returns:BeanDefinitionHolder

the scoped proxy definition

See Also
getTargetBeanName(String), getOriginalBeanName(String)
getOriginalBeanNameback to summary
public static String getOriginalBeanName(String targetBeanName)

Get the original bean name for the provided target bean name.

Parameters
targetBeanName:String

the target bean name for the scoped proxy

Returns:String

the original bean name

Exceptions
IllegalArgumentException:
if the supplied bean name does not refer to the target of a scoped proxy
Since
5.1.10
See Also
getTargetBeanName(String), isScopedTarget(String)
getTargetBeanNameback to summary
public static String getTargetBeanName(String originalBeanName)

Generate the bean name that is used within the scoped proxy to reference the target bean.

Parameters
originalBeanName:String

the original name of bean

Returns:String

the generated bean to be used to reference the target bean

See Also
getOriginalBeanName(String)
isScopedTargetback to summary
public static boolean isScopedTarget(String beanName)

Determine if the beanName is the name of a bean that references the target bean within a scoped proxy.

Since
4.1.4