diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java index dd97da3228f3..89a77213e080 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java @@ -302,10 +302,12 @@ private boolean isAspectMaterialized() { @Override public boolean equals(@Nullable Object other) { + // For equivalence, we only need to compare the preInstantiationPointcut fields since + // they include the declaredPointcut fields. In addition, we should not compare the + // aspectInstanceFactory fields since LazySingletonAspectInstanceFactoryDecorator does + // not implement equals(). return (this == other || (other instanceof PerTargetInstantiationModelPointcut that && - ObjectUtils.nullSafeEquals(this.declaredPointcut, that.declaredPointcut) && - ObjectUtils.nullSafeEquals(this.preInstantiationPointcut, that.preInstantiationPointcut) && - ObjectUtils.nullSafeEquals(this.aspectInstanceFactory, that.aspectInstanceFactory))); + ObjectUtils.nullSafeEquals(this.preInstantiationPointcut, that.preInstantiationPointcut))); } @Override