diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java index db6898f31024..da5a9070a245 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java @@ -56,8 +56,8 @@ /** * Factory that can create Spring AOP Advisors given AspectJ classes from - * classes honoring the AspectJ 5 annotation syntax, using reflection to - * invoke the corresponding advice methods. + * classes honoring AspectJ's annotation syntax, using reflection to invoke the + * corresponding advice methods. * * @author Rod Johnson * @author Adrian Colyer diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java index ea21644dc15c..2d2aabd07fae 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,27 +50,27 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx /** - * Sort the rest by AspectJ precedence. If two pieces of advice have - * come from the same aspect they will have the same order. - * Advice from the same aspect is then further ordered according to the + * Sort the supplied {@link Advisor} instances according to AspectJ precedence. + *
If two pieces of advice come from the same aspect, they will have the same + * order. Advice from the same aspect is then further ordered according to the * following rules: *
Important: Advisors are sorted in precedence order, from highest
* precedence to lowest. "On the way in" to a join point, the highest precedence
- * advisor should run first. "On the way out" of a join point, the highest precedence
- * advisor should run last.
+ * advisor should run first. "On the way out" of a join point, the highest
+ * precedence advisor should run last.
*/
@Override
- @SuppressWarnings("unchecked")
protected List This additional advice is needed when using AspectJ pointcut expressions
* and when using AspectJ-style advice.
*/
@Override
@@ -110,7 +110,7 @@ protected boolean shouldSkip(Class> beanClass, String beanName) {
/**
- * Implements AspectJ PartialComparable interface for defining partial orderings.
+ * Implements AspectJ's {@link PartialComparable} interface for defining partial orderings.
*/
private static class PartiallyComparableAdvisorHolder implements PartialComparable {
@@ -140,17 +140,19 @@ public Advisor getAdvisor() {
@Override
public String toString() {
- StringBuilder sb = new StringBuilder();
Advice advice = this.advisor.getAdvice();
- sb.append(ClassUtils.getShortName(advice.getClass()));
- sb.append(": ");
+ StringBuilder sb = new StringBuilder(ClassUtils.getShortName(advice.getClass()));
+ boolean appended = false;
if (this.advisor instanceof Ordered) {
- sb.append("order ").append(((Ordered) this.advisor).getOrder()).append(", ");
+ sb.append(": order = ").append(((Ordered) this.advisor).getOrder());
+ appended = true;
}
if (advice instanceof AbstractAspectJAdvice) {
+ sb.append(!appended ? ": " : ", ");
AbstractAspectJAdvice ajAdvice = (AbstractAspectJAdvice) advice;
+ sb.append("aspect name = ");
sb.append(ajAdvice.getAspectName());
- sb.append(", declaration order ");
+ sb.append(", declaration order = ");
sb.append(ajAdvice.getDeclarationOrder());
}
return sb.toString();
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java
index d013cda2c986..2d243fadc726 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java
@@ -27,20 +27,22 @@
/**
* Orders AspectJ advice/advisors by precedence (not invocation order).
*
- * Given two pieces of advice, {@code a} and {@code b}:
+ * Given two pieces of advice, {@code A} and {@code B}:
* Important: Note that unlike a normal comparator a return of 0 means
- * we don't care about the ordering, not that the two elements must be sorted
- * identically. Used with AspectJ PartialOrder class.
+ * Important: This comparator is used with AspectJ's
+ * {@link org.aspectj.util.PartialOrder PartialOrder} sorting utility. Thus, unlike
+ * a normal {@link Comparator}, a return value of {@code 0} from this comparator
+ * means we don't care about the ordering, not that the two elements must be sorted
+ * identically.
*
* @author Adrian Colyer
* @author Juergen Hoeller
@@ -59,16 +61,16 @@ class AspectJPrecedenceComparator implements Comparator Advisors or advices requiring ordering should implement the
+ * Advisors or advices requiring ordering should be annotated with
+ * {@link org.springframework.core.annotation.Order @Order} or implement the
* {@link org.springframework.core.Ordered} interface. This class sorts
- * Advisors by Ordered order value. Advisors that don't implement the
- * Ordered interface will be considered as unordered; they will appear
- * at the end of the advisor chain in undefined order.
+ * advisors using the {@link AnnotationAwareOrderComparator}. Advisors that are
+ * not annotated with {@code @Order} or don't implement the {@code Ordered}
+ * interface will be considered as unordered; they will appear at the end of the
+ * advisor chain in an undefined order.
*
* @author Rod Johnson
* @author Juergen Hoeller
- *
*
- *