mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
e1e072b75c
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