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
This commit renames Spr3896SuiteTests to comply with our naming
convention for test classes that should be executed via the Gradle
build.
The effect of this commit is that test classes included in that "suite"
are no longer executed twice in the build. Consequently, Gradle and
Bamboo will now report the same number of executed tests for the
spring-test project.
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
Prior to this commit, it was impossible to include a placeholder (i.e.,
${placeholder.name}) in a Properties file location configured via
@TestPropertySource if the placeholder was immediately followed by a
relative path (i.e., "../"). This was due to the fact that the location
was always cleaned using StringUtils.cleanPath(), which removed the
placeholder and the relative path syntax.
This commit fixes this by preserving all placeholders in
@TestPropertySource locations by simply not cleaning the locations if
they contain placeholders.
Closes gh-23544
This commit ensures that locations to resources configured via
@ContextConfiguration & @TestPropertySource are consistently cleaned
using StringUtils.clean().
See gh-23544
This commit introduces a collection of @Nested integration tests that
verify proper support for @TestPropertySource with explicit properties
files declared with absolute paths, relative paths, and placeholders in
the classpath and in the file system.
See gh-23544
This commit prepends "[{index}] " to all custom display names
configured via @ParameterizedTest.
This provides better diagnostics between the "technical names" reported
on the CI server vs. the "display names" reported within a developer's
IDE.
See gh-23451
Prior to this commit, there was no way to replace the Set-Cookie header
via MockHttpServletResponse. Specifically, an invocation of setHeader()
for the Set-Cookie header resulted in an additional Set-Cookie header
instead of replacing the existing one, which is in violation of the
contract for javax.servlet.http.HttpServletResponse.setHeader(...).
This commit refactors the internals of MockHttpServletResponse to ensure
that an existing Set-Cookie header is overwritten when set via an
invocation of setHeader(). This commit also verifies the expected
behavior for addHeader() and addCookie() with regard to multiple cookies.
Closes gh-23512
Prior to this commit, the invokeMethod() utility method in
ReflectionTestUtils only supported instance methods.
This commit brings the invokeMethod() support on par with the getField()
support by supporting the invocation of static methods via two new
invokeMethod() variants.
Closes gh-23504
The use of LinkedCaseInsensitiveMap, going back to 3.0, makes it
unnecessary to iterate over keys which can cause
ConcurrentModificationException.
Closes gh-23460
This commit reorganizes tasks and scripts in the build to only apply
them where they're needed. We're considering here 3 "types" of projects
in our build:
* the root project, handling documentation, publishing, etc
* framework modules (a project that's published as a spring artifact)
* internal modules, such as the BOM, our coroutines support and our
integration-tests
With this change, we're strealining the project configuration for all
spring modules and only applying plugins when needed (typically our
kotlin support).
See gh-23282
The recently added body(Object) variant can be confused easily with
body(Publisher, Class) forgetting to provide the element type and
only running into the IllegalArgumentException at runtime.
See gh-23212
This commit migrates the spring-test test suite from JUnit 4 to JUnit
Jupiter where applicable.
Tests specific to our JUnit 4 and TestNG support remain written using
those frameworks. In addition, some tests are still written in JUnit 4
if they extend a test class that should not be migrated to JUnit
Jupiter.
See gh-23451
This commit removes the JUnit 4 dependency from all modules except
spring-test which provides explicit JUnit 4 support.
This commit also includes the following.
- migration from JUnit 4 assertions to JUnit Jupiter assertions in all
Kotlin tests
- migration from JUnit 4 assumptions in Spring's TestGroup support to
JUnit Jupiter assumptions, based on org.opentest4j.TestAbortedException
- introduction of a new TestGroups utility class than can be used from
existing JUnit 4 tests in the spring-test module in order to perform
assumptions using JUnit 4's Assume class
See gh-23451