Example usage for org.springframework.aop.framework.autoproxy ProxyCreationContext getCurrentProxiedBeanName

List of usage examples for org.springframework.aop.framework.autoproxy ProxyCreationContext getCurrentProxiedBeanName

Introduction

In this page you can find the example usage for org.springframework.aop.framework.autoproxy ProxyCreationContext getCurrentProxiedBeanName.

Prototype

@Nullable
public static String getCurrentProxiedBeanName() 

Source Link

Document

Return the name of the currently proxied bean instance.

Usage

From source file:org.jdal.aop.SerializableProxyAdvisor.java

/**
 * Checks for {@link SerializableProxy} anntation at type level.
 * @return true if annotation found.//from ww w.j a va  2 s .co  m
 */
@Override
public boolean matches(Class<?> clazz) {
    SerializableProxy ann = AnnotationUtils.findAnnotation(clazz, SerializableProxy.class);

    if (ann != null && !SerializableAopProxy.class.isAssignableFrom(clazz)) {
        String beanName = ProxyCreationContext.getCurrentProxiedBeanName();
        if (beanName != null && !beanName.startsWith(SerializableProxyUtils.TARGET_NAME_PREFIX)) {
            configureReference(ann, beanName);
            return true;
        }
    }

    return false;
}

From source file:org.springframework.aop.aspectj.AspectJExpressionPointcut.java

@Nullable
protected String getCurrentProxiedBeanName() {
    return ProxyCreationContext.getCurrentProxiedBeanName();
}