Commit Graph

32657 Commits

Author SHA1 Message Date
Michael Kunze
00c7002354 Fix typo in class name
Closes gh-32664
2024-04-18 09:32:10 +02:00
Onji Kim
ec055da7c3 Reject negative Content-Length values in HttpHeaders
Prior to this commit, `HttpHeaders#setContentLength` would accept
negative values. Those are not allowed by the RFC and the headers
implementation only uses "-1" as a way to convey that no value was set.

This commit ensures that negative values are rejected.

Fixes gh-32660
2024-04-17 23:05:13 +02:00
Brian Clozel
c03f798dad Merge branch '6.1.x' 2024-04-17 22:47:44 +02:00
Brian Clozel
b3a45670f9 Do not set 0 Content-Length header in BufferingClientHttpRequestFactory
Prior to this commit, the `BufferingClientHttpRequestFactory`, through
the `AbstractBufferingClientHttpRequest`, would set a "Content-Length"
header value, even if the buffered body was empty.

This behavior is invalid since no request body would be set by the
client code in the first place.

This commit ensures that this header is only set if a request body has
been buffered and is about to be written to the request.

Fixes gh-32650
2024-04-17 22:44:36 +02:00
Arjen Poutsma
af23cc233e Add support for state override in new URL parser
See gh-32513
2024-04-17 16:33:53 +02:00
Arjen Poutsma
f21e05a9e4 Introduce new URL parser
This commit introduces a new URL parser based on algorithm provided in
the Living URL standard. This new UrlParser is used by
UriComponentsBuilder::fromUriString, replacing the regular expressions.

Closes gh-32513
2024-04-17 11:17:01 +02:00
Sam Brannen
8727d723f3 Polish "Bean Overriding in Tests" support 2024-04-16 17:08:15 +02:00
Simon Baslé
ce8758b83c Merge branch '6.1.x' 2024-04-16 16:47:01 +02:00
xumengqi
8ec27438e7 Fix transaction definition setTimeout error message since zero is valid
This commit rephrases the `DefaultTransactionDefinition#setTimeout`
exception message to better reflect the fact that 0 is a valid input
value.

Even though this often leads to a transaction immediately timing out
after opening, there is one notable case where this has another
meaningful effect: in Jakarta transactions (`UserTransaction`), when
passing 0 "the transaction service restores the default value".

Closes gh-32635
2024-04-16 16:39:23 +02:00
Simon Baslé
43b5c81dad Merge branch '6.1.x' 2024-04-16 16:29:53 +02:00
xumengqi
bf3278596c Include actual cause's message in various parsing exception messages
This change improves the message of several parsing-related exceptions
that would previously entirely swallow the original exception's message
and sometimes have a slightly misleading message as a result.

This is done by appending the cause's `toString` representation to the
IllegalArgumentException messages instead of an hardcoded "cause".

Closes gh-32636
2024-04-16 16:25:42 +02:00
Sam Brannen
69cb2a347a Update copyright date
See gh-32647
2024-04-16 15:11:12 +02:00
janghs
0d4ef4eafe Omit empty resource description in DeprecatedBeanWarner's log message
Closes gh-32647
2024-04-16 15:07:18 +02:00
Arjen Poutsma
051fd2ae4f Merge branch '6.1.x' 2024-04-16 11:44:02 +02:00
Arjen Poutsma
3971632415 Reintroduce SimpleClientHttpRequestFactory limitations
Closes gh-32641
2024-04-16 11:43:09 +02:00
Simon Baslé
02ee5de470 Document bean override in TestContext framework section of the manual
This change splits the documentation in the reference manual: the
`@TestBean`, `@MockitoBean` and `@MockitoSpyBean` annotations are kept
in the appendix and the general documentation about the feature is moved
into a dedicated sub-section of the TCF section.

Close gh-32490
2024-04-15 17:07:14 +02:00
Sam Brannen
afbce96fb7 Introduce getName() in SpEL's BeanReference
Closes gh-32640
2024-04-15 16:44:37 +02:00
Sam Brannen
3f34a13436 Polishing 2024-04-15 16:30:51 +02:00
Simon Baslé
fe83003324 Merge branch '6.1.x' 2024-04-15 14:21:51 +02:00
Simon Baslé
1e54916119 Ensure multipart data is deleted in WebFlux when connection terminates
Before this change temporary files would not consistently be deleted
when the connection which uploads the multipart files closes naturally.

This change uses the usingWhen Reactor operator to ensure that the
termination of the connection doesn't prevent individual file parts
from being deleted due to a cancellation signal.

Closes gh-31217
2024-04-15 14:20:48 +02:00
laterlaugh
5012843b12 Fix typos in comment and test
Closes gh-32628
2024-04-12 17:40:54 +02:00
Sam Brannen
b13963ee81 Reject private JUnit Jupiter lifecycle methods annotated with @⁠Autowired
Closes gh-32627
2024-04-12 14:27:38 +02:00
Sam Brannen
43cc18a5a1 Use literal monospace in SpEL templating section
Prior to this commit, the text `#{ }` was displayed as { } with a bright
green background.

This commit addresses this by making use of Asciidoc's literal monospace
feature: `+#{ }+`.
2024-04-11 14:00:46 +02:00
Brian Clozel
4d5536db21 Merge branch '6.1.x' 2024-04-11 11:33:16 +02:00
Brian Clozel
6e20af41bf Upgrade CI image to Java 23ea17 2024-04-11 11:32:48 +02:00
Brian Clozel
d99113661e Merge branch '6.1.x' 2024-04-11 11:24:58 +02:00
Spring Builds
c68c62b6c6 Next development version (v6.1.7-SNAPSHOT) 2024-04-11 08:26:17 +00:00
Brian Clozel
54dab45151 Merge branch '6.1.x' 2024-04-11 08:51:13 +02:00
Brian Clozel
494ed4e852 Refine UriComponentsBuilder parsing
This commit refines the expressions for the scheme, user info, host and
port parts of the URL in UriComponentsBuilder to better conform to
RFC 3986.

Fixes gh-32616
2024-04-11 08:49:11 +02:00
Stéphane Nicoll
2e3a923225 Polish 2024-04-11 08:45:26 +02:00
Juergen Hoeller
77c6f160fe Merge branch '6.1.x'
# Conflicts:
#	spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
#	spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverTests.java
#	spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java
2024-04-10 18:29:48 +02:00
Simon Baslé
2d33aac350 Improve Bean Overriding support, testing and documentation
This commit improves on the bean overriding feature in several ways:
the API is simplified and polished (metadata and processor contracts,
 etc...).

The commit also reworks infrastructure classes (context customizer,
test execution listener, BeanOverrideBeanFactoryPostProcessor, etc...).
Parsing of annotations is now fully stateless.

In order to avoid OverrideMetadata in bean definition and to make a
first step towards AOT support, the BeanOverrideBeanFactoryPostProcessor
now delegates to a BeanOverrideRegistrar to track classes to parse,
the metadata-related state as well as for the field injection methods
for tests.

Lastly, this commit increases the test coverage for the provided
annotations and adds integration tests and fixes a few `@TestBean`
issues.
2024-04-10 18:16:43 +02:00
Juergen Hoeller
39cd31613b Polishing 2024-04-10 18:06:32 +02:00
Sébastien Deleuze
711ddd1ac6 Merge branch '6.1.x' 2024-04-10 17:55:09 +02:00
Sébastien Deleuze
ca2b3c170c Add Kotlin hints for enclosing class
This is needed by Kotlin reflection in order to be able to list
class members on native.

Closes gh-32472
2024-04-10 17:53:12 +02:00
Brian Clozel
35a0d24dc3 Merge branch '6.1.x' 2024-04-10 16:44:20 +02:00
Brian Clozel
019ce4418c BufferingClientHttpRequestWrapper should not write empty body
Prior to this commit, `BufferingClientHttpRequestWrapper` would always
write to the actual client request body, even if the buffered content
was empty (empty byte array).
This would cause issues with specific client request factories,
especially the OkHttp variant, that would consider empty byte arrays as
non-empty body and would reject such cases for GET requests with an
"IllegalArgumentException: method GET must not have a request body".

This commit only writes to the request if the buffered content is not
empty.

Fixes gh-32612
2024-04-10 16:41:16 +02:00
Sam Brannen
ae3dc0d4b1 Merge SpEL IndexAccessor feature into main
This set of commits introduces a new IndexAccessor SPI for the Spring
Expression Language (SpEL) which allows third parties to customize the
SpEL Indexer.

A custom IndexAccessor implementation can be registered in a
StandardEvaluationContext.

For an example, see the JacksonArrayNodeIndexAccessor in IndexingTests
in the spring-expression module.

See gh-26409
Closes gh-26478
2024-04-10 16:07:33 +02:00
Sam Brannen
1c9cff668c Honor IndexAccessor#canWrite() and cache accessors
See gh-26409
See gh-26478
2024-04-10 15:54:34 +02:00
Sam Brannen
15511890bd Revise Javadoc for IndexAccessor
See gh-26409
See gh-26478
2024-04-10 15:54:34 +02:00
Sam Brannen
22bfe7da5a Introduce proper error handling for IndexAccessor support in SpEL
See gh-26409
See gh-26478
2024-04-10 15:54:34 +02:00
Sam Brannen
5c6b82a947 Change IndexAccessor#read()'s return type to TypedValue
Prior to this commit, the read() method in the IndexAccessor SPI
declared a return type of ValueRef which introduced a package cycle.

This commit addresses this by aligning with the PropertyAccess SPI and
returning TypedValue from IndexAccessor's read() method. This commit
also reworks the internals of Indexer based on a new, local
IndexAccessorValueRef implementation.

See gh-26409
See gh-26478
2024-04-10 15:54:34 +02:00
Sam Brannen
b7c3833732 Revise null-safety contracts in IndexAccessor SPI
When indexing into an object, the target object can never be null.

See gh-26409
See gh-26478
2024-04-10 15:54:34 +02:00
Sam Brannen
d91277095a Initial review and polish of IndexAccessor support in SpEL
See gh-26409
See gh-26478
2024-04-10 15:54:34 +02:00
ljmn3211
50a0000ed7 Introduce IndexAccessor SPI to customize the SpEL Indexer
See gh-26409
See gh-26478
2024-04-10 15:14:50 +02:00
Sébastien Deleuze
d6e9562aeb Revert "Prevent compilation warnings with @Nullable"
This reverts commit dc242df533.
2024-04-10 14:39:47 +02:00
Juergen Hoeller
f6089afd0e Use ClassLoaderAwareGeneratorStrategy with UndeclaredThrowableStrategy delegate
See gh-32469
2024-04-10 13:23:24 +02:00
Mikaël Francoeur
561583842f Consistent handling of undeclared checked exceptions in CGLIB proxies (#32469)
Co-authored-by: hengyunabc <hengyunabc@gmail.com>
Co-authored-by: Mikaël Francoeur <mikael.francoeur@ticketmaster.com>
2024-04-10 12:11:33 +02:00
Sam Brannen
bed3689001 Polishing 2024-04-10 10:56:41 +02:00
Stéphane Nicoll
3d85ec2354 Merge pull request #32610 from alidandach
* pr/32610:
  Polish "Use try-with-resources when applicable"
  Use try-with-resources when applicable

Closes gh-32610
2024-04-10 09:52:25 +02:00