While resolving the regression raised in gh-23571, it came to our
attention that not all of our ClassFilter and MethodMatcher
implementations were properly cacheable with CGLIB generated proxies
due to missing (or improper) equals() and hashCode() implementations.
Although such deficiencies may not manifest themselves as bugs in Core
Spring's default arrangements, these might cause issues in custom
arrangements in user applications.
This commit addresses this by ensuring that ClassFilter and
MethodMatcher implementations properly implement equals() and
hashCode(). In addition, missing toString() implementations have been
added to improve diagnostics for logging and debugging.
Closes gh-23659
Spring Framework 5.2 M1 introduced a memory leak for applications using
@Async methods. Specifically, in a large test suite with multiple
ApplicationContexts that were closed (e.g., via @DirtiesContext,
@MockBean, or context cache eviction), the JVM process could run out of
memory.
Underlying cause: Due to a missing equals() implementation in Spring's
new AnnotationCandidateClassFilter, CGLIB's static cache of generated
classes indirectly retained references to BeanFactory instances for the
closed ApplicationContexts for the duration of the test suite.
This commit fixes this regression by introducing a proper equals()
implementation in AnnotationCandidateClassFilter. This commit also
introduces corresponding hashCode() and toString() implementations.
Closes gh-23571
Prior to this commit, the Spring Framework build would partially use the
dependency management plugin to import and enforce BOMs.
This commit applies the dependency management plugin to all Java
projects and regroups all version management declaration in the root
`build.gradle` file (versions and exclusions).
Some versions are overridden in specific modules for
backwards-compatibility reasons or extended support.
This commit also adds the Gradle versions plugin that checks for
dependency upgrades in artifact repositories and produces a report; you
can use the following:
./gradlew dependencyUpdates
This commit polishes tests in spring-aop by using
OrderComparator.sort() and lambda expressions instead of anonymous
classes where feasible.
Closes gh-23458
ClassLoaderAwareUndeclaredThrowableStrategy fails with a VerifyError on recent JDKs after the CGLIB 3.3 upgrade. The alternative is to replace it with a plain ClassLoaderAwareGeneratorStrategy (extracted from CglibSubclassingInstantiationStrategy) and custom UndeclaredThrowableException handling in CglibMethodInvocation.
See gh-23453