Java Code Examples for org.springframework.aop.support.AopUtils#canApply()

The following examples show how to use org.springframework.aop.support.AopUtils#canApply() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessStartAnnotationBeanPostProcessor.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
 	if (bean instanceof AopInfrastructureBean) {
		// Ignore AOP infrastructure such as scoped proxies.
		return bean;
	}
	Class<?> targetClass = AopUtils.getTargetClass(bean);
	if (AopUtils.canApply(this.advisor, targetClass)) {
		if (bean instanceof Advised) {
			((Advised) bean).addAdvisor(0, this.advisor);
			return bean;
		}
		else {
			ProxyFactory proxyFactory = new ProxyFactory(bean);
			// Copy our properties (proxyTargetClass etc) inherited from ProxyConfig.
			proxyFactory.copyFrom(this);
			proxyFactory.addAdvisor(this.advisor);
			return proxyFactory.getProxy(this.beanClassLoader);
		}
	}
	else {
		// No async proxy needed.
		return bean;
	}
}
 
Example 2
Source File: AbstractAdvisingBeanPostProcessor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Check whether the given class is eligible for advising with this
 * post-processor's {@link Advisor}.
 * <p>Implements caching of {@code canApply} results per bean target class.
 * @param targetClass the class to check against
 * @see AopUtils#canApply(Advisor, Class)
 */
protected boolean isEligible(Class<?> targetClass) {
	Boolean eligible = this.eligibleBeans.get(targetClass);
	if (eligible != null) {
		return eligible;
	}
	if (this.advisor == null) {
		return false;
	}
	eligible = AopUtils.canApply(this.advisor, targetClass);
	this.eligibleBeans.put(targetClass, eligible);
	return eligible;
}
 
Example 3
Source File: AbstractAdvisingBeanPostProcessor.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Check whether the given class is eligible for advising with this
 * post-processor's {@link Advisor}.
 * <p>Implements caching of {@code canApply} results per bean target class.
 * @param targetClass the class to check against
 * @see AopUtils#canApply(Advisor, Class)
 */
protected boolean isEligible(Class<?> targetClass) {
	Boolean eligible = this.eligibleBeans.get(targetClass);
	if (eligible != null) {
		return eligible;
	}
	if (this.advisor == null) {
		return false;
	}
	eligible = AopUtils.canApply(this.advisor, targetClass);
	this.eligibleBeans.put(targetClass, eligible);
	return eligible;
}
 
Example 4
Source File: AbstractAdvisingBeanPostProcessor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check whether the given class is eligible for advising with this
 * post-processor's {@link Advisor}.
 * <p>Implements caching of {@code canApply} results per bean target class.
 * @param targetClass the class to check against
 * @see AopUtils#canApply(Advisor, Class)
 */
protected boolean isEligible(Class<?> targetClass) {
	Boolean eligible = this.eligibleBeans.get(targetClass);
	if (eligible != null) {
		return eligible;
	}
	eligible = AopUtils.canApply(this.advisor, targetClass);
	this.eligibleBeans.put(targetClass, eligible);
	return eligible;
}
 
Example 5
Source File: AbstractAdvisingBeanPostProcessor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Check whether the given class is eligible for advising with this
 * post-processor's {@link Advisor}.
 * <p>Implements caching of {@code canApply} results per bean target class.
 * @param targetClass the class to check against
 * @see AopUtils#canApply(Advisor, Class)
 */
protected boolean isEligible(Class<?> targetClass) {
	Boolean eligible = this.eligibleBeans.get(targetClass);
	if (eligible != null) {
		return eligible;
	}
	eligible = AopUtils.canApply(this.advisor, targetClass);
	this.eligibleBeans.put(targetClass, eligible);
	return eligible;
}