AsyncAnnotationBeanPostProcessor consistently adds @Async processing as first Advisor in the chain (SPR-7147)

master
Juergen Hoeller 15 years ago
parent ad5c7aeb31
commit 68055ba4c9
  1. 8
      org.springframework.context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessor.java

@ -89,10 +89,10 @@ public class AsyncAnnotationBeanPostProcessor extends ProxyConfig
} }
public void afterPropertiesSet() { public void afterPropertiesSet() {
this.asyncAnnotationAdvisor = (this.executor != null) ? this.asyncAnnotationAdvisor = (this.executor != null ?
new AsyncAnnotationAdvisor(this.executor) : new AsyncAnnotationAdvisor(); new AsyncAnnotationAdvisor(this.executor) : new AsyncAnnotationAdvisor());
if (this.asyncAnnotationType != null) { if (this.asyncAnnotationType != null) {
this.asyncAnnotationAdvisor.setAsyncAnnotationType(asyncAnnotationType); this.asyncAnnotationAdvisor.setAsyncAnnotationType(this.asyncAnnotationType);
} }
} }
@ -115,7 +115,7 @@ public class AsyncAnnotationBeanPostProcessor extends ProxyConfig
Class<?> targetClass = AopUtils.getTargetClass(bean); Class<?> targetClass = AopUtils.getTargetClass(bean);
if (AopUtils.canApply(this.asyncAnnotationAdvisor, targetClass)) { if (AopUtils.canApply(this.asyncAnnotationAdvisor, targetClass)) {
if (bean instanceof Advised) { if (bean instanceof Advised) {
((Advised) bean).addAdvisor(this.asyncAnnotationAdvisor); ((Advised) bean).addAdvisor(0, this.asyncAnnotationAdvisor);
return bean; return bean;
} }
else { else {

Loading…
Cancel
Save