Commit Graph

30479 Commits

Author SHA1 Message Date
Sam Brannen 9b58e1ff71 Merge branch '6.1.x' 2024-06-23 17:44:47 +02:00
Sam Brannen 5f765fc8ce Polishing 2024-06-23 13:22:08 +02:00
Stephane Nicoll 2650da2b53 Provide more control over registration of GeneratedFiles
This commit provides an advanced handling of generated files that
provides more control over files registration. The callback provides
a FileHandler that can determine if the file already exists and its
content. The caller can then chose to override the content or leave it
as it is.

Closes gh-31331
2024-06-22 18:52:33 +02:00
Sam Brannen 6b456b6157 Upgrade to FreeMarker 2.3.33 2024-06-22 16:55:56 +02:00
Sam Brannen e6b77d301d Merge branch '6.1.x' 2024-06-22 16:52:42 +02:00
Sam Brannen 000b563e83 Use consistent formatting for view name in AbstractView 2024-06-22 16:51:37 +02:00
Sam Brannen c571ee1f95 Fix typo in comment 2024-06-22 16:51:28 +02:00
Stéphane Nicoll b134f253b5 Move the testing section after data and web
Closes gh-33083
2024-06-21 14:35:33 +02:00
Stéphane Nicoll 043b93d255 Upgrade to HtmlUnit 4.2.0
Closes gh-33081
2024-06-21 14:30:02 +02:00
Stéphane Nicoll 6e87aba100 Merge branch '6.1.x' 2024-06-21 14:14:26 +02:00
Stéphane Nicoll 899f6308d9 Fix name of GitHub actions bot
See gh-gh-33076
2024-06-21 14:14:05 +02:00
Stéphane Nicoll d43dba63a1 Document AssertJ support for MockMvc
This commit restructures the section on MockMvc so that the anchors
are easier to read. The standard integration has moved to a
Hamcrest Integration section  at the same level as HtmlUnit Integration,
and a new AssertJ Integration section has been created.

Closes gh-32454
2024-06-21 12:51:35 +02:00
Juergen Hoeller 7d236e29bb Merge branch '6.1.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
2024-06-21 11:23:37 +02:00
Juergen Hoeller a580d6d6fc Leniently ignore type mismatch for LoadTimeWeaverAware beans
Closes gh-33082
2024-06-21 11:22:48 +02:00
Juergen Hoeller 7fc2814a34 Merge branch '6.1.x' 2024-06-20 18:57:49 +02:00
Juergen Hoeller 66eddf99af Include original exception if cause is null
Closes gh-33080
See gh-32952
2024-06-20 18:56:43 +02:00
Sam Brannen eeb9959cb9 Polishing 2024-06-20 17:13:48 +02:00
Stéphane Nicoll e5993d92c4 Merge branch '6.1.x' 2024-06-20 14:16:13 +02:00
Stéphane Nicoll e94ec80df4 Exclude GitHub Actions bot from changelog
Closes gh-33076
2024-06-20 14:15:54 +02:00
Juergen Hoeller 52e1f30bfe Merge branch '6.1.x' 2024-06-20 13:48:55 +02:00
Juergen Hoeller 2861e570fd Catch and log LinkageError in getTypeForFactoryMethod
Closes gh-33075
2024-06-20 13:47:43 +02:00
Brian Clozel e3048bce11 Merge branch '6.1.x' 2024-06-19 18:15:55 +02:00
Stéphane Nicoll 5cf8978d22 Restore proper code generation for types with nested generics
This commit aligns code generation to recent improvement in the core
container regarding type detection. Now that nested types are properly
resolved, our code generation that uses hasResolvableGenerics() is
taking the wrong decision if only a nested type has an unresolved
generics. Previously, this was hidden by the fact that the core
container would not resolve them recursively.

A new hasResolvableGenerics() method allows to verify that at least
one direct generic type is resolved. This restore our intent of checking
at the first level only and let recursive invocations figure out if they
have to write the raw type or the type with generics.

Closes gh-33069
2024-06-19 17:48:39 +02:00
Spring Builds ee7a1e8b7e Next development version (v6.1.11-SNAPSHOT) 2024-06-19 15:37:10 +00:00
Juergen Hoeller 1047e1f722 Declare complete set of default methods on ObjectProvider
Closes gh-33070
2024-06-19 16:53:10 +02:00
Brian Clozel 4cbaaa3b1d Move Servlet HTTP Message Conversion to its own section
Closes gh-33063
2024-06-19 15:45:16 +02:00
Arjen Poutsma e62255512a Encode based on response character encoding
Before this commit, characters were always encoded with the default
encoding (i.e. ISO-8859-1). Now, the character encoding of the response
is used.

Closes gh-files
2024-06-19 14:26:38 +02:00
Brian Clozel c72e31bcf5 Merge branch '6.1.x' 2024-06-19 12:51:23 +02:00
Brian Clozel f7307c9e07 Avoid recording RestClient observations twice
Prior to this commit, the fix for gh-32575 introduced cases where the
client observation would be stopped twice.

This commit ensures that `RestClient` observations are stopped only once
when the response is closed, or before throwing an unhanlded exception.

Fixes gh-33068
2024-06-19 12:46:21 +02:00
Sam Brannen ce49354400 Sync MockHttpServletResponse implementations
See gh-33019
2024-06-19 12:31:17 +02:00
Sébastien Deleuze 1d363e5a41 Use UTF-8 with JSON in MockHttpServletResponse
This commit makes MockHttpServletResponse consistent with the other
parts of the framework where the body of a response is read as an UTF-8
String when the content type is application/json or similar, overriding
the ISO-8859-1 default Servlet encoding.

Closes gh-33019
2024-06-19 09:33:43 +02:00
Brian Clozel 2116d71d81 Merge branch '6.1.x' 2024-06-18 19:28:05 +02:00
Brian Clozel 098c4b1dd7 Use Sonatype S01 token in release pipeline 2024-06-18 19:25:20 +02:00
Juergen Hoeller 82af8e62c1 Merge branch '6.1.x' 2024-06-18 18:32:29 +02:00
Juergen Hoeller 65dbfd09b4 Defensive PersistenceExceptionTranslator bean retrieval on shutdown
Closes gh-33067
2024-06-18 18:31:15 +02:00
Sam Brannen d7668eec00 Merge branch '6.1.x' 2024-06-18 16:45:28 +02:00
Sam Brannen 203fa75196 Support all "connection reset" phrases in DisconnectedClientHelper
Prior to this commit, the isClientDisconnectedException() method in
DisconnectedClientHelper checked whether the message of the ultimate
exception in an exception chain contained one of the phrases "broken
pipe" or "connection reset by peer". However, that failed to match if
the exception message contained "Connection reset", which is the case
for the SocketException thrown by throwConnectionReset() in
sun.nio.ch.SocketChannelImpl.

This commit therefore replaces the "connection reset by peer" phrase
with "connection reset" in order to support all exception messages
containing "connection reset".

Closes gh-33064
2024-06-18 16:43:06 +02:00
Stéphane Nicoll 1eaa9cd2f4 Polish 2024-06-18 16:04:19 +02:00
Brian Clozel 17abb4d25d Add codecs for JSON support with Protobuf
Prior to this commit, WebFlux had Protobuf codecs for managing the
`Message`/`"application/x-protobuf"` encoding and decoding.
The `com.google.protobuf:protobuf-java-util` library has additional
support for JSON (de)serialization, but this is not supported by
existing codecs.

This commit adds the new `ProtobufJsonEncode` and `ProtobufJsonDecoder`
classes that support this use case. Note, the `ProtobufJsonDecoder` has
a significant limitation: it cannot decode JSON arrays as
`Flux<Message>` because there is no available non-blocking parser able
to tokenize JSON arrays into streams of `Databuffer`. Instead,
applications should decode to `Mono<List<Message>>` which causes
additional buffering but is properly supported.

Closes gh-25457
2024-06-18 15:48:46 +02:00
Stéphane Nicoll 24bbc6d80d Improve support of async request in MockMvcTester
This commit improves the handling of asynchronous requests by offering
a way to opt-in for the raw async result. This provides first class
support for asserting a request that might still be in process as well
as the asyncResult, if necessary.

See gh-33040
2024-06-18 15:19:47 +02:00
Stéphane Nicoll a7503e7200 Add explicit support for asynchronous requests in MockMvcTester
This commit makes asynchronous requests first class by providing a
MvcTestResult that represents the final, completed, state of a request
by default. Previously, the result was an intermediate step that may
require an ASYNC dispatch to be fully usable. Now it is de facto
immutable.

To make things a bit more explicit, an `.exchange(Duration)` method has
been added to provide a dedicated time to wait. The default applies a
default timeout that is consistent with what MVcResult#getAsyncResult
does.

Given that we apply the ASYNC dispatch automatically, the intermediate
response is no longer available by default. As a result, the asyncResult
is not available for assertions.

As always, it is possible to use plain MockMvc by using the `perform`
method that takes the regular RequestBuilder as an input. When this
method is invoked, no asynchronous handling is done.

Closes gh-33040
2024-06-18 13:03:09 +02:00
Stéphane Nicoll a1b0099795 Add missing debug(Writer) alternative
See gh-33059
2024-06-18 12:40:29 +02:00
Arjen Poutsma 54c37ffd6f Check response code in SimpleClientHttpResponse::getBody
The error stream can be null with an empty body, so check the response
code instead.

Closes gh-33020
2024-06-18 12:33:56 +02:00
Stéphane Nicoll acf73404c1 Simplify Mock[Multipart]HttpServletRequestBuilder
This commit simplifies the package private constructors on those two
builders now that the URI can be specified by dedicated builder methods.

Closes gh-33062
2024-06-18 10:10:07 +02:00
Stéphane Nicoll d76f37c90b Add multipart support for MockMvcTester
File uploads with MockMvc require a separate
MockHttpServletRequestBuilder implementation. This commit applies the
same change to support AssertJ on this builder, but for the multipart
version.

Any request builder can now use `multipart()` to "down cast" to a
dedicated multipart request builder that contains the settings
configured thus far.

Closes gh-33027
2024-06-18 09:43:08 +02:00
Stéphane Nicoll f2137c99e5 Add debug support for MvcResult
This commit adds a debug() shortcut to print the detail of a MvcResult
to ease debugging when a request did not work as expected.

Closes gh-33059
2024-06-18 06:43:26 +02:00
Stéphane Nicoll 84bcb65dd1 Streamline assertions on exceptions
This commit simplifies assertions on MockMvc requests that have failed
to process. A now general hasFailed/doesNotHaveFailed/failure provides
the necessary to assert the exception.

Any attempt to access anything from the result with an unresolved
exception still fails as before.

Closes gh-33060
2024-06-18 06:23:13 +02:00
Juergen Hoeller 6561490fd9 Expose isClosed() method on AbstractApplicationContext
Closes gh-33058
2024-06-17 21:08:28 +02:00
Juergen Hoeller 5c68f3f4ef Reject @Bean method with method-level @Autowired declaration
Closes gh-33051
2024-06-17 21:08:21 +02:00
Juergen Hoeller a58e27eded Use CollectionFactory#newLinkedHashSet for method arguments
See gh-32291
2024-06-17 18:50:31 +02:00