Commit Graph

32130 Commits

Author SHA1 Message Date
Sébastien Deleuze
4d09eb569b Refine RequestResponseBodyMethodProcessorKotlinTests
Improve read tests and fix copyright.

See gh-34992
2025-06-05 14:07:27 +02:00
Sébastien Deleuze
a439e9030f Fix collection support in AbstractKotlinSerializationHttpMessageConverter
AbstractKotlinSerializationHttpMessageConverter#getSupportedMediaTypes(Class<?>)
currently invokes transitively supports(Class<?>) which always return false
with generic types.

This commit adds an override that just invokes getSupportedMediaTypes().

Closes gh-34992
2025-06-05 12:02:22 +02:00
James Yuzawa
aa5c0dcd72 Add caching headers to unmodified static resources
per https://www.rfc-editor.org/rfc/rfc7232#section-4.1

The server generating a 304 response MUST generate any of the
following header fields that would have been sent in a 200 (OK)
response to the same request: Cache-Control, Content-Location, Date,
ETag, Expires, and Vary.

Closes gh-34614

Signed-off-by: James Yuzawa <jtyuzawa@gmail.com>
2025-06-05 10:58:24 +02:00
Brian Clozel
4a46d957f3 Fix out of bounds exception for PathPattern#combine
Prior to this commit, combining the "/*" and  "/x/y" path patterns
would result in a `StringIndexOutOfBoundsException`.

This commit fixes this problem and revisits the implementation for
better consistency:

* "/*" + "/x/y" is now "/x/y"
* "/x/*.html" + "/y/file.*" is now rejected because they don't share the
  same prefix.

This change also adds the relevant Javadoc to the `PathPattern#combine`
method.

Fixes gh-34986
2025-06-04 20:18:33 +02:00
Sam Brannen
4df93a825b Update copyright headers and fix test method name 2025-06-04 11:28:55 +02:00
rstoyanchev
be17315f63 Add mention of CompletionStage in "Async Requests"
Closes gh-34991
2025-06-03 19:10:03 +01:00
DongNyoung Lee
31903a9d92 Fix typo in MockClientHttpRequest Javadoc
Closes gh-34856

Signed-off-by: DongNyoung Lee <121621378+Dongnyoung@users.noreply.github.com>
2025-06-03 19:05:32 +01:00
rstoyanchev
06f69915cb Polishing contribution
Closes gh-34885
2025-06-03 19:04:17 +01:00
addoDev
d9459bdc74 Improve mvc-ann-async.adoc
Added section for WebAsyncTask return type along with java and
kotlin example code

See gh-34885

Signed-off-by: addoDev <adityaraochokkadi@gmail.com>
2025-06-03 18:57:40 +01:00
Tran Ngoc Nhan
3f0892b42c Fix typos
Closes gh-34876

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-06-03 18:55:15 +01:00
Patrick Strawderman
182d654fa8 Add optimized DataBufferInputStream overrides
Add optimized DataBufferInputStream overrides for readNBytes, skip, and transferTo; all of them
allocate byte buffers which we can either avoid (in the case of skip) or size more precisely since
the number of remaining bytes is known.

Closes gh-34799

Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>
2025-06-03 18:06:43 +02:00
Johnny Lim
bbae625850 Add Javadoc since for gh-34745
Closes gh-34940

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-06-03 18:06:24 +02:00
Sam Brannen
f376d1b525 Remove @⁠Contract declaration for CodeFlow.isIntegerForNumericOp()
Since the Number parameter is not @⁠Nullable, the @⁠Contract declaration
is unnecessary.

Closes gh-34985
2025-06-03 12:58:45 +02:00
Sam Brannen
707b7698ce Consistent @⁠Contract expression formatting 2025-06-02 17:00:28 +02:00
Johannes Jank
5b9cb8291e Fix exception name in ModelAttribute docs
Closes gh-34980

Signed-off-by: Johannes Jank <johannes.wengert@googlemail.com>
2025-06-02 16:30:16 +02:00
Brian Clozel
659472f9e3 Use HTTP methods in JdkClientHttpRequest when possible
Prior to this commit, we would use the
`java.net.http.HttpRequest.Builder#method(String, BodyPublisher)` to
create HTTP requests for the JDK HttpClient. This method requires a
non-null body publisher; providing an empty publisher writes a
"Content-Length: 0" header to all requests.

As of Java 19, this behavior changes for `HttpRequest.Builder#GET` and
similar methods, where the body publisher is considered as null and no
"Content-Length" header is written.

This commit aligns with this behavior and favors dedicated HTTP methods
whenever available.`

Closes gh-34971
2025-06-02 15:36:20 +02:00
Dmytro Nosan
c2d678879f Fix AOT code generation for autowired inner class constructor
Prior to this commit, argument index handling in
AutowiredArgumentsCodeGenerator suffered from an off-by-one error when
generating code for an autowired inner class constructor.

Since the startIndex is already properly calculated for an inner class in
InstanceSupplierCodeGenerator.buildGetInstanceMethodForConstructor(...),
there is no need to adjust the argument indexes within
AutowiredArgumentsCodeGenerator.generateCode(...).

Closes gh-34974

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
2025-06-02 10:43:21 +02:00
Sam Brannen
f207c0ed5c Polish contribution
See gh-34949
2025-06-02 10:10:46 +02:00
Mengqi Xu
bbf61c74ab Fix REPLY_CHANNEL header check in MessageHeaderAccessor
Prior to this commit, the verifyType() method in MessageHeaderAccessor
checked if REPLY_CHANNEL ended with the given header name which does
not make much sense and is inconsistent with the ERROR_CHANNEL check.

This commit therefore checks if the REPLY_CHANNEL is equal to the given
header name, analogous to the ERROR_CHANNEL check.

See gh-34881
Closes gh-34949

Signed-off-by: Mengqi Xu <2663479778@qq.com>
2025-06-02 10:00:01 +02:00
Aurh1l
aea66265f7 Fix syntax in @⁠SqlGroup example
Closes gh-34972
2025-05-31 12:15:50 +02:00
Sam Brannen
016294b067 Avoid overriding methods deprecated in JUnit Jupiter 5.13
See gh-34969
2025-05-30 14:54:57 +02:00
Sam Brannen
8201193650 Upgrade to JUnit 5.13
Closes gh-34969
2025-05-30 13:57:18 +02:00
Dhruv
562157d2c0 Update X-Forwarded-Proto doc to say "https / http"
Closes gh-34959

Signed-off-by: Dhruv <dhruv2015@hotmail.co.uk>
2025-05-28 16:41:16 +02:00
Dmitry Sulman
63db3d06ab Fix method links in Javadoc of WebClient
Closes gh-34938

Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
2025-05-28 11:05:00 +01:00
rstoyanchev
dc52042b85 Polishing contribution
Closes gh-34939
2025-05-28 11:05:00 +01:00
dujiabao
cff6e02162 Correct sample in multipart-forms.adoc
See gh-34939

Signed-off-by: dujiabao <42103826+WayneDu98@users.noreply.github.com>
2025-05-28 11:05:00 +01:00
rstoyanchev
983af78352 Configurable limit on HandlerMappingIntrospector
Closes gh-34918
2025-05-28 11:05:00 +01:00
Sébastien Deleuze
67ed64a41d Remove not null checks in BeanUtilsKotlinTests 2025-05-28 10:31:07 +02:00
Sébastien Deleuze
d777b70889 Ignore DefaultConstructorMarker in BeanUtils#getParameterNames
Closes gh-34760
2025-05-28 10:12:09 +02:00
Sam Brannen
472c4012ca Remove obsolete note from Javadoc for BeanDefinitionReader 2025-05-27 11:32:05 +02:00
Sam Brannen
90be94a4a5 Use ConversionService from Environment in PropertySourcesPlaceholderConfigurer
This commit fixes a regression in PropertySourcesPlaceholderConfigurer
that was introduced in Spring Framework 6.2.7.

Specifically, this commit reinstates automatic String-conversion of
values from PropertySources in the Environment using the
ConversionService configured in the Environment.

See gh-34861
Closes gh-34936
2025-05-27 11:20:09 +02:00
Juergen Hoeller
d9e261aecd Enforce backwards compatibility for null bean in shortcut code path
Closes gh-34929
2025-05-27 09:47:39 +02:00
Juergen Hoeller
15d1455acb Check for package-visible constructor in case of ClassLoader mismatch
Closes gh-34950
2025-05-27 09:47:29 +02:00
Sam Brannen
53844b068c Test conversion support in PropertySourcesPlaceholderConfigurer
This commit introduces a @⁠Disabled "regression test" which demonstrates
that PropertySourcesPlaceholderConfigurer uses the ConversionService
from the Environment.

See gh-34936
2025-05-26 18:18:52 +02:00
Sam Brannen
d78264756e Support only Object property values in MockEnvironment test fixture
The setProperty() and withProperty() methods in MockEnvironment were
originally introduced with (String, String) signatures; however, they
should have always had (String, Object) signatures in order to comply
with the MockPropertySource and PropertySource APIs.

To address that, this commit changes the signatures of these methods so
that they only accept Object values for properties.

NOTE: this commit only affects the internal MockEnvironment used as a
test fixture. This commit does not affect the official, public
MockEnvironment implementation in spring-test.

See gh-34947
See gh-34948
2025-05-26 17:29:16 +02:00
Sam Brannen
d0efc2230c Support Object property values in MockEnvironment
The setProperty() and withProperty() methods in MockEnvironment were
originally introduced with (String, String) signatures; however, they
should have always had (String, Object) signatures in order to comply
with the MockPropertySource and PropertySource APIs.

To address that, this commit introduces variants of these methods that
accept Object values for properties.

Closes gh-34947
2025-05-26 17:22:52 +02:00
Sam Brannen
6a6abac003 Polish Javadoc for MockPropertySource 2025-05-26 17:21:31 +02:00
Sébastien Deleuze
66f8eb02bd Upgrade to HttpComponents HttpClient 5.5
Closes gh-34941
2025-05-26 10:25:00 +02:00
Sam Brannen
274b97ca14 Upgrade to Gradle 8.14.1
Closes gh-34937
2025-05-23 17:32:53 +02:00
Sam Brannen
e4b4512bcb Update code due to change in nullability contract
See gh-34933
2025-05-22 17:43:38 +02:00
Sam Brannen
db5809f968 Remove obsolete @⁠Contract declaration for StreamUtils.drain()
Closes gh-34933
2025-05-22 17:23:35 +02:00
Sam Brannen
d890a38f3c Support registration of non-public BeanDefinitionReader via @⁠ImportResource
Prior to this commit, a BeanDefinitionReader registered via
@⁠ImportResource was required to be public and have a public
constructor that accepts a single BeanDefinitionRegistry. However, the
public visibility requirements are not necessary, and the requirements
for the constructor's formal parameter list is not documented.

To address those issues, this commit removes the public visibility
restrictions and documents that a BeanDefinitionReader registered via
@⁠ImportResource must declare a constructor that accepts a single
BeanDefinitionRegistry.

In addition, this commit includes the cause of the instantiation
failure in case the registered BeanDefinitionReader cannot be
instantiated.

Closes gh-34928
2025-05-21 15:37:04 +02:00
Sam Brannen
98cef503fb Remove obsolete TODO
See gh-10976
2025-05-21 15:37:04 +02:00
Sam Brannen
362fe12704 Polishing 2025-05-21 15:36:58 +02:00
Brian Clozel
2af0323c21 Use Content-Type charset in JAXB message converters
Prior to this commit, the JAXB message converters would only rely on the
encoding declaration inside the XML document for reading the document.
This would then use the default UTF-8 encoding, even if the HTTP message
has the `"application/xml;charset=iso-8859-1"` Content-Type.

This commit ensures that both `Jaxb2CollectionHttpMessageConverter` and
`Jaxb2RootElementHttpMessageConverter` use the encoding declared in the
HTTP Content-Type, if present.

Fixes gh-34745
2025-05-19 16:57:57 +02:00
Brian Clozel
fdab8fabd2 Avoid duplicate Content-Type in MockHttpServletRequest
Fixes gh-34913
2025-05-19 12:04:46 +02:00
Brian Clozel
ae8b45a290 Next development version (v6.2.8-SNAPSHOT) 2025-05-15 11:07:25 +02:00
rstoyanchev
ee62701f56 Make use of PatternMatchUtils ignoreCase option
Closes gh-34801
2025-05-15 08:18:56 +01:00
Juergen Hoeller
fa168ca78a Revise FactoryBean locking behavior for strict/lenient consistency
After the bootstrap phase (and with spring.locking.strict=true during the bootstrap phase), getSingletonFactoryBeanForTypeCheck always locks. In a background bootstrap thread, it never locks. Otherwise, it tries locking and explicitly resolves the bean class for subsequent type-based resolution (even for a component-scanned class) when it fails to acquire the lock. Furthermore, getObjectFromFactoryBean follows the same locking algorithm for post-processing.

Closes gh-34902
2025-05-15 01:45:09 +02:00
rstoyanchev
3c228a5c1d Add missing @since tags in PatternMatchUtils
See: gh-34801
2025-05-14 15:15:50 +01:00