public abstract class

ExposeBeanNameAdvisors

extends Object
java.lang.Object
   ↳ org.springframework.aop.interceptor.ExposeBeanNameAdvisors

Class Overview

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 a bean() pointcut designator with AspectJ.

Typically used in Spring auto-proxying, where the bean name is known at proxy creation time.

See Also

Summary

Public Constructors
ExposeBeanNameAdvisors()
Public Methods
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 introduction
static String getBeanName(MethodInvocation mi)
Find the bean name for the given invocation.
static String getBeanName()
Find the bean name for the current invocation.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ExposeBeanNameAdvisors ()

Public Methods

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.

Parameters
beanName the bean name to expose

public static Advisor createAdvisorWithoutIntroduction (String beanName)

Create a new advisor that will expose the given bean name, with no introduction

Parameters
beanName bean name to expose

public static String getBeanName (MethodInvocation mi)

Find the bean name for the given invocation. Assumes that an ExposeBeanNameAdvisor has been included in the interceptor chain.

Parameters
mi MethodInvocation that should contain the bean name as an attribute
Returns
  • the bean name (never null)
Throws
IllegalStateException if the bean name has not been exposed

public static String getBeanName ()

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.

Returns
  • the bean name (never null)
Throws
IllegalStateException if the bean name has not been exposed