Commit Graph

34078 Commits

Author SHA1 Message Date
Sam Brannen fd6b18a07a Merge branch '6.2.x' 2025-10-22 17:09:38 +02:00
Sam Brannen ba70c1384a Polish SpringExtension internals 2025-10-22 17:07:53 +02:00
Sam Brannen d24a31d469 Support JUnit Jupiter ExtensionContextScope.TEST_METHOD
Historically, @⁠Autowired fields in an enclosing class of a @⁠Nested
test class have been injected from the ApplicationContext for the
enclosing class. If the enclosing test class and @⁠Nested test class
share the same ApplicationContext configuration, things work as
developers expect. However, if the enclosing class and @⁠Nested test
class have different ApplicationContexts, that can lead to
difficult-to-debug scenarios. For example, a bean injected into the
enclosing test class will not participate in a test-managed transaction
in the @⁠Nested test class (see gh-34576).

JUnit Jupiter 5.12 introduced a new ExtensionContextScope feature which
allows the SpringExtension to behave the same for @⁠Autowired fields as
it already does for @⁠Autowired arguments in lifecycle and test
methods. Specifically, if a developer sets the ExtensionContextScope to
TEST_METHOD — for example, by configuring the following configuration
parameter as a JVM system property or in a `junit-platform.properties`
file — the SpringExtension already supports dependency injection from
the current, @⁠Nested ApplicationContext in @⁠Autowired fields in an
enclosing class of the @⁠Nested test class.

junit.jupiter.extensions.testinstantiation.extensioncontextscope.default=test_method

However, there are two scenarios that fail as of Spring Framework
6.2.12.

1. @⁠TestConstructor configuration in @⁠Nested class hierarchies.
2. Field injection for bean overrides (such as @⁠MockitoBean) in
   @⁠Nested class hierarchies.

Commit 82c34f7b51 fixed the SpringExtension to support scenario #2
above.

To fix scenario #1, this commit revises
BeanOverrideTestExecutionListener's injectField() implementation to
look up the fields to inject for the "current test instance" instead of
for the "current test class".

This commit also introduces tests for both scenarios.

See gh-34576
See gh-35676
Closes gh-35680
2025-10-22 17:00:44 +02:00
Vedran Pavic c5ec169c83 Update JdkClientHttpRequest javadoc
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
This commit updates `JdkClientHttpRequest.TimeoutHandler` javadoc to
reference up-to-date JDK issue that tracks improvements to HTTP client's
request timeout handling.

Closes gh-35581

Signed-off-by: Vedran Pavic <vedran@vedranpavic.com>
2025-10-22 15:39:43 +02:00
Brian Clozel 2f66c07b0d Merge branch '6.2.x' 2025-10-22 12:31:35 +02:00
Brian Clozel a5141b187a Fix '**' parsing within a PathPattern segment
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:25], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Prior to this commit, a regexp path segment ending with a double wilcard
(like "/path**") would be incorrectly parsed as a double wildcard
segment ("/**").

This commit fixes the incorrect parsing.

See gh-35679
2025-10-22 12:21:57 +02:00
Brian Clozel d3c1e678c2 Support wildcard path elements at the start of path patterns
Prior to this commit, the `PathPattern` and `PathPatternParser` would
allow multiple-segments matching and capturing with the following:

* "/files/**" (matching 0-N segments until the end)
* "/files/{*path}" (matching 0-N segments until the end and capturing
  the value as the "path" variable)

This would be only allowed as the last path element in the pattern and
the parser would reject other combinations.

This commit expands the support and allows multiple segments matching at
the beginning of the path:

* "/**/index.html" (matching 0-N segments from the start)
* "/{*path}/index.html" (matching 0-N segments until the end and capturing
  the value as the "path" variable)

This does come with additional restrictions:

1. "/files/**/file.txt" and "/files/{*path}/file.txt" are invalid,
   as multiple segment matching is not allowed in the middle of the
   pattern.
2. "/{*path}/files/**" is not allowed, as a single "{*path}" or "/**"
   element is allowed in a pattern
3. "/{*path}/{folder}/file.txt"  "/**/{folder:[a-z]+}/file.txt" are
   invalid because only a literal pattern is allowed right after
   multiple segments path elements.

Closes gh-35679
2025-10-22 12:21:57 +02:00
Sébastien Deleuze dce7518be3 Upgrade to Jackson 3.0.1
Closes gh-35677
2025-10-22 08:32:25 +02:00
Brian Clozel 914f83f4a6 Improve RestTemplate to RestClient migration guide
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
This commit improve the reference documentation in order to:

* highlight the deprecation status of `RestTemplate`
* improve the migration guide for `RestClient`, better explaining
  possible behavior differences and a migration strategy.

Closes gh-35620
2025-10-21 21:54:48 +02:00
Sam Brannen e937d8ee8a Remove reference to @⁠javax.inject.Inject on main
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-10-21 18:02:12 +02:00
Sam Brannen bda8f20b0b Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-10-21 17:43:10 +02:00
Sam Brannen 82c34f7b51 Introduce isAutowirableConstructor(Executable,PropertyProvider) in TestConstructorUtils
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:25], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
This commit introduces a new isAutowirableConstructor(Executable, PropertyProvider)
overload in TestConstructorUtils and deprecates all other existing variants
for removal in 7.1.

Closes gh-35676
2025-10-21 17:37:04 +02:00
Sam Brannen 3c14b42f82 Merge branch '6.2.x' 2025-10-21 16:32:00 +02:00
Sam Brannen cb0f26a152 Use consistent naming for Bean Override test classes
cherry-picked from c6e5cfe03d
2025-10-21 16:25:12 +02:00
Sam Brannen 711df0259b Merge branch '6.2.x' 2025-10-21 15:38:48 +02:00
Sam Brannen bccfbfd630 Fix previous commit for 6.2.x compatibility
See gh-35674
2025-10-21 15:37:35 +02:00
Brian Clozel 5923d36de3 Merge branch '6.2.x' 2025-10-21 13:50:25 +02:00
Brian Clozel 506b76032f Add missing reflection hints for JdbcUtils
This commit adds the missing reflection hints for `JdbcUtils`, as this
class reflects on `java.sql.Types` public fields.

Fixes gh-35674
2025-10-21 13:50:13 +02:00
Sébastien Deleuze 3bedf42fbc Fix Jetty multipart client support with Java 25
Closes gh-35531
2025-10-21 12:46:17 +02:00
Sébastien Deleuze 79795c8e09 Avoid compilation error on WebTestClient without Hamcrest
This commit removes JSpecify (TYPE_USE) annotations on
org.hamcrest.Matcher parameters to prevent a related
"Cannot attach type annotations" error when Hamcrest
(optional dependency) is not in the classpath with Java > 22.

Closes gh-35666
2025-10-21 12:18:10 +02:00
Juergen Hoeller 83edf6a4aa Adapt test for MockServletContext version
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
See gh-35671
2025-10-21 01:07:03 +02:00
Juergen Hoeller 687fc935a8 Merge branch '6.2.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
#	spring-test/src/main/java/org/springframework/mock/web/MockServletContext.java
#	spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockServletContext.java
2025-10-21 01:04:38 +02:00
Juergen Hoeller 7adcd99ea2 Polishing
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:25], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-10-21 00:59:56 +02:00
Juergen Hoeller aa625f0ba9 Consistently declare Servlet mock classes with Servlet 6.1 baseline
Closes gh-35671
2025-10-21 00:43:28 +02:00
Juergen Hoeller 7ca2a5dec5 Early support for Jakarta Servlet 6.2 and Jakarta Activation 2.2
Closes gh-35670
2025-10-21 00:42:03 +02:00
Sébastien Deleuze 29d4a91903 Comment broken Jakarta Javadoc URL
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-10-20 17:39:00 +02:00
Sébastien Deleuze 5fd3c9c449 Fix `@Import` with multiple bean registrars
This commit uses a MultiValueMap instead of a Map to store bean
registrars, allowing to support multiple bean registrars imported by
the same configuration class.

Closes gh-35653
2025-10-20 17:36:51 +02:00
wakingrufus b65390828e Add a test for multiple bean registrars
This commit add a test for multiple bean registrars imported by the same
configuration class.

See gh-35653
Signed-off-by: wakingrufus <wakingrufus@gmail.com>
2025-10-20 17:36:51 +02:00
Brian Clozel cab46c74d5 Downgrade to JSONassert 1.5.x
Closes gh-34901
2025-10-20 17:14:45 +02:00
Sébastien Deleuze baaddae38e Convert PropagationContextElement to a Java class
In order to avoid having Java types depending on Kotlin types
which breaks the compilation in Eclipse IDE.

Closes gh-35661
2025-10-20 16:40:31 +02:00
Brian Clozel 6d824586bb Polishing contribution
Fixes gh-35659
2025-10-20 15:32:36 +02:00
Damian Malczewski 8a6576eace Make HttpStatus.resolve return non-deprecated one
In previous versions, HttpStatus.resolve (or valueOf) always returned
non-deprecated HTTP status for given code. This was ensured implicitly,
by placing non-deprecated enum entries before their respective
deprecations. This was not ensured for 413 Content Too Large.

See gh-35659

Signed-off-by: Damian Malczewski <damian.m.malczewski@gmail.com>
2025-10-20 15:32:19 +02:00
Brian Clozel 5accc21223 Clean HTTP response headers after decompression in JDK client
Prior to this commit, gh-35225 introduced HTTP response body
decompression support for "gzip" and "deflate" encodings for the
`JdkClientHttpRequestFactory`.

While body decompression works, the client keeps the "Content-Encoding"
and "Content-Length" response headers intact, which misleads further
response handling: the body size has changed and it is not compressed
anymore.

This commit ensures that the relevant response headers are removed from
the HTTP response after decompression.

Fixes gh-35668
2025-10-20 11:38:25 +02:00
Juergen Hoeller b85993c7cb Add test for HibernatePersistenceConfiguration
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
See gh-35662
2025-10-19 10:45:57 +02:00
Juergen Hoeller 228662ad9f Derive StatelessSession from transactional Session on Hibernate 7.2
Closes gh-35664
See gh-7184
2025-10-19 10:45:43 +02:00
Juergen Hoeller c063249bd4 Consistent support for JPA 3.2 transaction timeout
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-35663
2025-10-18 15:44:41 +02:00
Juergen Hoeller b261b74793 Merge branch '6.2.x'
# Conflicts:
#	spring-aop/src/main/java/org/springframework/aop/framework/CoroutinesUtils.java
#	spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java
#	spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/MutablePersistenceUnitInfo.java
#	spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceXmlParsingTests.java
2025-10-18 15:32:19 +02:00
Juergen Hoeller 765e30c3a6 Polishing
Backport Bot / build (push) Has been cancelled Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:25], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
2025-10-18 15:30:15 +02:00
Juergen Hoeller beb224e3f9 Add support for JPA 3.2 PersistenceConfiguration
See gh-35662
2025-10-18 15:05:38 +02:00
Sam Brannen cfb268f6de Suppress warning in SmartPersistenceUnitInfoInvocationHandler 2025-10-18 13:58:11 +02:00
Sam Brannen 0fbebd856f Revise contribution
See gh-35660
2025-10-18 13:50:22 +02:00
Kamil Krzywanski 948367092c Use empty array constants instead of repeatedly creating new ones
Closes gh-35660

Signed-off-by: Kamil Krzywański <kamilkrzywanski01@gmail.com>
Signed-off-by: Kamil Krzywanski <kamilkrzywanski01@gmail.com>
2025-10-18 13:36:06 +02:00
Sam Brannen 687bc7652d Avoid unnecessary import for SpringExtension's Javadoc 2025-10-18 13:35:54 +02:00
Sébastien Deleuze 16851b5128 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
2025-10-17 15:46:36 +02:00
HJC96 d7fc07e73c Fix typos
Backport Bot / build (push) Has been cancelled Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:25], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
Closes gh-35656
Signed-off-by: HJC96 <gkswlcjs2@naver.com>
2025-10-17 15:46:27 +02:00
Brian Clozel 44de925c5e Add reflection hints for SpringPersistenceUnitInfo
Fixes gh-35655
2025-10-17 14:34:15 +02:00
Dónal Murtagh 22ecab5aab Fix code snippets in Javadoc for exchangeSuccessfully()
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-35642

Signed-off-by: Dónal Murtagh <donal.murtagh@clarusonesourcing.com>
2025-10-16 18:44:33 +02:00
Brian Clozel a7c43d90fd Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-10-16 09:32:41 +02:00
Brian Clozel 18a879779e Next development version (v6.2.13-SNAPSHOT)
Backport Bot / build (push) Has been cancelled Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:25], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
2025-10-16 09:32:20 +02:00
Juergen Hoeller 1c64f867c8 Upgrade to Netty 4.2.7
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
See gh-35637
2025-10-15 19:44:18 +02:00