类 ExposeBeanNameAdvisors
- java.lang.Object
- org.springframework.aop.interceptor.ExposeBeanNameAdvisors
public abstract class ExposeBeanNameAdvisors extends Object
Convenient methods for creating advisors that may be used when autoproxying beans created with the Spring IoC container, binding the bean name to the current invocation. May support abean()
pointcut designator with AspectJ.Typically used in Spring auto-proxying, where the bean name is known at proxy creation time.
- 从以下版本开始:
- 2.0
- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
NamedBean
构造器概要
构造器 构造器 说明 ExposeBeanNameAdvisors()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static Advisor
createAdvisorIntroducingNamedBean(String beanName)
Create a new advisor that will expose the given bean name, introducing the NamedBean interface to make the bean name accessible without forcing the target object to be aware of this Spring IoC concept.static Advisor
createAdvisorWithoutIntroduction(String beanName)
Create a new advisor that will expose the given bean name, with no introductionstatic String
getBeanName()
Find the bean name for the current invocation.static String
getBeanName(MethodInvocation mi)
Find the bean name for the given invocation.
构造器详细资料
ExposeBeanNameAdvisors
public ExposeBeanNameAdvisors()
方法详细资料
getBeanName
public static String getBeanName() throws IllegalStateException
Find the bean name for the current invocation. Assumes that an ExposeBeanNameAdvisor has been included in the interceptor chain, and that the invocation is exposed with ExposeInvocationInterceptor.- 返回:
- the bean name (never
null
) - 抛出:
IllegalStateException
- if the bean name has not been exposed
getBeanName
public static String getBeanName(MethodInvocation mi) throws IllegalStateException
Find the bean name for the given invocation. Assumes that an ExposeBeanNameAdvisor has been included in the interceptor chain.- 参数:
mi
- MethodInvocation that should contain the bean name as an attribute- 返回:
- the bean name (never
null
) - 抛出:
IllegalStateException
- if the bean name has not been exposed
createAdvisorWithoutIntroduction
public static Advisor createAdvisorWithoutIntroduction(String beanName)
Create a new advisor that will expose the given bean name, with no introduction- 参数:
beanName
- bean name to expose
createAdvisorIntroducingNamedBean
public static Advisor createAdvisorIntroducingNamedBean(String beanName)
Create a new advisor that will expose the given bean name, introducing the NamedBean interface to make the bean name accessible without forcing the target object to be aware of this Spring IoC concept.- 参数:
beanName
- the bean name to expose