Skip to content

Commit

Permalink
Add AnnotationClassOrMethodPointcut.hashCode() impl
Browse files Browse the repository at this point in the history
Due to the absence of a `hashCode()` implementation, proxies for the `AnnotationClassOrMethodPointcut` class are regenerated each time, 
which causes them to be stored in the `org.springframework.cglib.core.internal.LoadingCache` (with `RetryConfiguration.AnnotationClassOrMethodPointcut` being part of the composite key for this object).
This results in an excessive accumulation of generated proxies in memory, ultimately leading to metaspace overflow.
  • Loading branch information
NorsaG authored Sep 23, 2024
1 parent 4886b75 commit 76b41e8
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2023 the original author or authors.
* Copyright 2006-2024 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.
Expand All @@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

Expand Down Expand Up @@ -68,6 +69,7 @@
* @author Markus Heiden
* @author Gary Russell
* @author Yanming Zhou
* @author Evgeny Lazarev
* @since 1.1
*
*/
Expand Down Expand Up @@ -242,6 +244,11 @@ public boolean equals(Object other) {
return ObjectUtils.nullSafeEquals(this.methodResolver, otherAdvisor.methodResolver);
}

@Override
public int hashCode() {
return Objects.hash(this.methodResolver);
}

}

private final class AnnotationClassOrMethodFilter extends AnnotationClassFilter {
Expand Down

0 comments on commit 76b41e8

Please sign in to comment.