From f7496a393d3200c02ce4f2f30864703018675a62 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Fri, 22 Sep 2023 18:16:56 +0200 Subject: [PATCH] Expand scope of equals() in PerTargetInstantiationModelPointcut This commit expands the scope of equality checks in the implementation of equals() for PerTargetInstantiationModelPointcut to include all fields instead of just the pointcut expression for the declared pointcut. See gh-31238 --- .../InstantiationModelAwarePointcutAdvisorImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 f4d150d64d4d..dd97da3228f3 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 @@ -303,7 +303,9 @@ private boolean isAspectMaterialized() { @Override public boolean equals(@Nullable Object other) { return (this == other || (other instanceof PerTargetInstantiationModelPointcut that && - ObjectUtils.nullSafeEquals(this.declaredPointcut.getExpression(), that.declaredPointcut.getExpression()))); + ObjectUtils.nullSafeEquals(this.declaredPointcut, that.declaredPointcut) && + ObjectUtils.nullSafeEquals(this.preInstantiationPointcut, that.preInstantiationPointcut) && + ObjectUtils.nullSafeEquals(this.aspectInstanceFactory, that.aspectInstanceFactory))); } @Override