Class AutoProxyUtils
java.lang.Object
org.springframework.aop.framework.autoproxy.AutoProxyUtils
Utilities for auto-proxy aware components.
Mainly for internal use within the framework.
- Since:
- 2.0.3
- Author:
- Juergen Hoeller
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Object
Attribute value for specifically signalling that all implemented interfaces need to be proxied (through an emptyClass
array).static final String
The bean name of the internally managed auto-proxy creator.static final String
Bean definition attribute that may indicate the interfaces to be proxied (in case of it getting proxied in the first place).static final String
Bean definition attribute that indicates the original target class of an auto-proxied bean, for example, to be used for the introspection of annotations on the target class behind an interface-based proxy.static final String
Bean definition attribute that may indicate whether a given bean is supposed to be proxied with its target class (in case of it getting proxied in the first place). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetermineTargetClass
(ConfigurableListableBeanFactory beanFactory, @Nullable String beanName) Determine the original target class for the specified bean, if possible, otherwise falling back to a regulargetType
lookup.static boolean
shouldProxyTargetClass
(ConfigurableListableBeanFactory beanFactory, @Nullable String beanName) Determine whether the given bean should be proxied with its target class rather than its interfaces.
-
Field Details
-
DEFAULT_PROXY_CONFIG_BEAN_NAME
The bean name of the internally managed auto-proxy creator.- Since:
- 7.0
- See Also:
-
EXPOSED_INTERFACES_ATTRIBUTE
Bean definition attribute that may indicate the interfaces to be proxied (in case of it getting proxied in the first place). The value is either a single interfaceClass
or an array ofClass
, with an empty array specifically signalling that all implemented interfaces need to be proxied.- Since:
- 7.0
- See Also:
-
ALL_INTERFACES_ATTRIBUTE_VALUE
Attribute value for specifically signalling that all implemented interfaces need to be proxied (through an emptyClass
array).- Since:
- 7.0
- See Also:
-
PRESERVE_TARGET_CLASS_ATTRIBUTE
Bean definition attribute that may indicate whether a given bean is supposed to be proxied with its target class (in case of it getting proxied in the first place). The value isBoolean.TRUE
orBoolean.FALSE
.Proxy factories can set this attribute if they built a target class proxy for a specific bean, and want to enforce that bean can always be cast to its target class (even if AOP advices get applied through auto-proxying).
- See Also:
-
ORIGINAL_TARGET_CLASS_ATTRIBUTE
Bean definition attribute that indicates the original target class of an auto-proxied bean, for example, to be used for the introspection of annotations on the target class behind an interface-based proxy.- Since:
- 4.2.3
- See Also:
-
-
Constructor Details
-
AutoProxyUtils
public AutoProxyUtils()
-
-
Method Details
-
shouldProxyTargetClass
public static boolean shouldProxyTargetClass(ConfigurableListableBeanFactory beanFactory, @Nullable String beanName) Determine whether the given bean should be proxied with its target class rather than its interfaces. Checks the"preserveTargetClass" attribute
of the corresponding bean definition.- Parameters:
beanFactory
- the containing ConfigurableListableBeanFactorybeanName
- the name of the bean- Returns:
- whether the given bean should be proxied with its target class
- See Also:
-
determineTargetClass
public static @Nullable Class<?> determineTargetClass(ConfigurableListableBeanFactory beanFactory, @Nullable String beanName) Determine the original target class for the specified bean, if possible, otherwise falling back to a regulargetType
lookup.- Parameters:
beanFactory
- the containing ConfigurableListableBeanFactorybeanName
- the name of the bean- Returns:
- the original target class as stored in the bean definition, if any
- Since:
- 4.2.3
- See Also:
-