Commit Graph

30382 Commits

Author SHA1 Message Date
Stéphane Nicoll c36e270481 Upgrade to Reactor 2024.0.0-M3
Closes gh-33006
2024-06-11 14:47:40 +02:00
Stéphane Nicoll a5432a82e9 Merge branch '6.1.x' 2024-06-11 14:46:32 +02:00
Stéphane Nicoll 261dac87cc Upgrade to Reactor 2023.0.7
Closes gh-33007
2024-06-11 14:42:08 +02:00
Stéphane Nicoll 89e894205a Improve exception message to include affected configuration class
Closes gh-32998
2024-06-11 14:24:28 +02:00
Brian Clozel a6fb7e99a0 Support for Protobuf 4.x
This commit compiles our Protobuf against 4.27, effectively raising our
baseline to 3.9+.

This commit also re-generates all the Java messages from the .proto spec
using the latest protoc binary.

Closes gh-33011
2024-06-11 14:12:55 +02:00
Stéphane Nicoll 2a680934ee Harmonize equals/hashCode of OverrideMetadata to use class identity
This commit harmonizes the equals/hashCode behavior of OverrideMetadata
to always take the implementation class as a factor for its identity.

This is important as two OverrideMetadata implementations could use
the same strategy and other settings while creating the override value
in a totally different way. This commit makes sure they are identified
as different.

Closes gh-33005
2024-06-11 12:03:31 +02:00
Stéphane Nicoll 1be92f82af Polish 2024-06-11 11:58:19 +02:00
Stéphane Nicoll 28f62abda4 Use the field name as a fallback qualifier for Bean Overriding
This commit harmonizes how a candidate bean definition is determined
for overriding using `@TestBean`, `@MockitoBean`, and `@MockitoSpyBean`.

Previously, a qualifier was necessary even if the name of the annotated
field matches the name of a candidate. After this commit, such candidate
will be picked up transparently, the same it is done for regular
autowiring.

This commit also reviews the documentation of the feature as considering
the field means that its name is taken into account to compute a cache
key if by-type lookup is requested.

Closes gh-32939
2024-06-11 11:30:01 +02:00
Sébastien Deleuze 4c7374797e Polishing
Closes gh-32931
2024-06-11 10:20:14 +02:00
Sébastien Deleuze 611367e4bb Add coroutine variant of WebExceptionHandler
See gh-32931
2024-06-11 10:09:17 +02:00
Juergen Hoeller 3d8488a7d8 Upgrade to Micrometer 1.13.1
Closes gh-33000
2024-06-11 09:13:42 +02:00
Juergen Hoeller e43e659983 Merge branch '6.1.x'
# Conflicts:
#	framework-docs/modules/ROOT/pages/core/beans/definition.adoc
#	framework-platform/framework-platform.gradle
#	spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java
2024-06-11 09:11:42 +02:00
Juergen Hoeller fce2f49e46 Polishing (aligned with main) 2024-06-11 09:07:09 +02:00
Juergen Hoeller eca2b9657e Documentation notes for @Bean overriding and bean name matching
Closes gh-32825
2024-06-11 09:06:33 +02:00
Juergen Hoeller e48f37d956 Upgrade to Micrometer 1.12.7
Closes gh-33001
2024-06-11 09:05:48 +02:00
Juergen Hoeller ddc397dd05 Upgrade to spring-javaformat-checkstyle 0.0.42 2024-06-11 09:04:30 +02:00
Stéphane Nicoll 720b7c1dac Merge branch '6.1.x' 2024-06-11 06:53:22 +02:00
Stéphane Nicoll 6b7f0bd4b6 Fix typo 2024-06-11 06:47:42 +02:00
Sébastien Deleuze 68e6b152ef Merge branch '6.1.x' 2024-06-10 22:46:03 +02:00
Sébastien Deleuze c97a895f09 Add support for double backslashes to StringUtils#cleanPath
Closes gh-32962
2024-06-10 22:25:31 +02:00
Juergen Hoeller 42c17eb787 Documentation notes for @Bean overriding and bean name matching
See gh-31052
See gh-28122
2024-06-10 16:43:05 +02:00
Stéphane Nicoll b9a6ba1242 Fix package tangle in bean override tests
This commit fixes a package tangle between the root bean override
package and its sub-packages. This was vastly improved with the
introduction of `@DummyBean` but we still had a few tests that were
at the wrong place.
2024-06-10 15:23:36 +02:00
Stéphane Nicoll 96302a7102 Stop using a conventional suffix for TestBean factory methods
This commit changes how factory method for `@TestBean` usage is
discovered. Previously the field name or bean name suffixed with
'TestOverride' was used. It sounds more natural to just use the
field name or bean name, leaving cases where a suffix is required
to explicitly providing the method name.

As part of this change, the exception messages have been revisited as
it's less since the method name candidates have the exact same name
as the field or bean name. A `()` is added to make it more clear the
name is for a method.

Closes gh-32940
2024-06-10 12:52:21 +02:00
rstoyanchev 5787bc569d Merge branch '6.1.x' 2024-06-10 10:48:49 +01:00
rstoyanchev 3b13f2ed38 Update code-of-conduct email 2024-06-10 10:48:06 +01:00
Stéphane Nicoll 45e9f04b57 Remove TestOverrideMetadata and use dummy implementation
TestOverrideMetadata was doing byName lookup by default, even without
a bean name. This makes writing tests that need to do by type lookup
way more complicated that it should.

This commit introduces DummyBean, that merely replaces two types with
hardcoded values. It also exposes the raw attribute of OverrideMetadata
and doesn't override anything from it to make sure the behavior is not
altered.

Closes gh-32982
2024-06-10 11:27:27 +02:00
Juergen Hoeller 457bf9416c Configure individual timeouts for specific shutdown phases
Closes gh-32985
2024-06-10 11:00:47 +02:00
Stéphane Nicoll b7e4fa06c3 Merge branch '6.1.x' 2024-06-10 10:02:41 +02:00
Stéphane Nicoll a0eebca0cf Merge pull request #32993 from hlmg
* pr/32993:
  Fix typo

Closes gh-32993
2024-06-10 10:02:36 +02:00
hlmg c6c64e6fe7 Fix typo
See gh-32993
2024-06-10 10:00:37 +02:00
Stéphane Nicoll 536de9ac80 Allow MockitoBean to create a mock for a bean that does not exist
This commit aligns the by-type lookup for bean overrides with what was
done when a bean name is present. It now correctly generate a bean
name rather than failing because no bean of that type exists.

Closes gh-32990
2024-06-10 09:57:27 +02:00
Brian Clozel bc98410acf Merge branch '6.1.x' 2024-06-10 09:47:57 +02:00
Brian Clozel 0ca393c0dc Restrict memory allocation in ContentCachingRequestWrapper
Prior to this commit, the `ContentCachingRequestWrapper` could allocate
a `FastByteArrayOutputStream` block that was larger than the content
cache limit given as a consturctor argument. This was due to an
optimization applied in gh-31834 for allocating the right content cache
size when the request size is known.

Fixes gh-32987
2024-06-10 09:46:01 +02:00
Carlos Corbacho e95e4423bb Do not swallow exceptions on failing to release a savepoint
By swallowing the exception on failing to release a savepoint, we are hiding
client code from database errors that they may need to be aware of or handle.

e.g. if the connection is now dead when trying to release the savepoint, by
swallowing the exception here, client code has no way of knowing this now until
the next operation on the database, which will yield a confusing message about
the problem and obscures where the failure occurred as it will be in a different
part of their code that throws any exception.

Swallowing the exception here is also inconsistent with all the other database
calls in the Transaction Object, where we always raise an exception up and let
client code decide how to handle the error.
2024-06-09 13:08:57 +02:00
Brian Clozel 24997b3356 Merge branch '6.1.x' 2024-06-07 19:02:53 +02:00
Brian Clozel 6681394886 Stop observations for async requests in Servlet filter
Prior to this commit, the `ServerHttpObservationFilter` would support
async dispatches and would do the following:

1. start the observation
2. call the filter chain
3. if async has started, do nothing
4. if not in async mode, stop the observation

This behavior would effectively rely on Async implementations to
complete and dispatch the request back to the container for an async
dispatch. This is what Spring web frameworks do and guarantee.

Some implementations complete the async request but do not dispatch
back; as a result, observations could leak as they are never stopped.

This commit changes the support of async requests. The filter now
opts-out of async dispatches - the filter will not be called for those
anymore. Instead, if the application started async mode during the
initial container dispatch, the filter will register an AsyncListener to
be notified of the outcome of the async handling.

Fixes gh-32730
2024-06-07 19:01:57 +02:00
Sébastien Deleuze c39ce10619 Merge branch '6.1.x' 2024-06-07 18:42:10 +02:00
Sébastien Deleuze 172987c874 Ignore checkpointOnRefresh after restore
Closes gh-32978
2024-06-07 18:41:37 +02:00
Stéphane Nicoll 373cf30b75 Polish 2024-06-07 17:11:38 +02:00
Stéphane Nicoll 55a7a49863 Merge pull request #32941 from m4tt30c91
* pr/32941:
  Polish contribution
  Add support for specifying a read timeout for the reactive jdk client

Closes gh-32941
2024-06-07 17:08:49 +02:00
Stéphane Nicoll 329b53309a Polish contribution
See gh-32941
2024-06-07 17:06:28 +02:00
Matteo Cristoforo 916ed5c0a9 Add support for specifying a read timeout for the reactive jdk client
See gh-32941
2024-06-07 17:01:23 +02:00
Stéphane Nicoll 7916f74942 Review TCF cache support for bean override
This commit reviews how bean override support can influence the key of
an application context cached by the TCF. OverrideMetadata and its
subclasses now implement a proper equals/hashCode pair that is tested
in various scenarios.

Due to how the TCF operates, OverrideMetadata has to be computed in
two locations:

1. In a ContextCustomizerFactory, using the metadata in the enclosing
class if any. This determines whether a customizer is needed in the
first place. The computed set of unique metadata identifies the
customizer and participates in the application context cache's key.
2. In the TestExecutionListener so that it knows the override points
it has to process.

Parsing of the metadata based on a test class has been greatly
simplified and moved to OverrideMetadata proper as we don't need several
flavors. 1 and 2 are using the same algorithm with the former wrapping
that in a Set to compute a proper key.

BeanOverrideContextCustomizerEqualityTests provides a framework for
testing edge cases as we only care about whether the created
ContextCustomizer behaves correctly against the identity of another.

Closes gh-32884
2024-06-07 16:44:57 +02:00
Stéphane Nicoll 02517e5011 Polish
This commit reviews the structure of several classes to comply with
our guidelines. Also, rather than exposing a static method to configure
the context in a test, we call the high-level API directly.
2024-06-07 16:44:57 +02:00
Stéphane Nicoll 0165529d97 Align OverrideMetadata arguments and harmonize bean name
Rather than having to override the getBeanName method when there is one,
this commit moves it as a @Nullable argument. This makes sure that
equals and hashCode consistently use the bean name. getBeanName cannot
be final just yet as the test infrastructure overrides it.

Also, arguments are now ordered consistently, which improves code
readability and type signature.
2024-06-07 16:44:57 +02:00
Stéphane Nicoll 8b66eca932 Harmonize OverrideMetadata implementations
This commit makes sure that each OverrideMetadata implementation is
a top level class with a consistent name.
2024-06-07 16:44:57 +02:00
Brian Clozel e8c122c00a Fix MockCookie Partitioned support
See gh-31454
2024-06-07 14:49:15 +02:00
Sam Brannen 9cfd455dde Merge branch '6.1.x' 2024-06-07 14:19:38 +02:00
Thomas Deblock 47a5ebfde6 Support canEncode() for JAXBElement in Jaxb2XmlEncoder
Commit d7970e4ab8 introduced support for JAXBElement in
Jaxb2XmlEncoder's encodeValue() method; however, canEncode() still
returned false for a JAXBElement element type.

This commit revises canEncode() so that it returns true for an element
type that is assignable from JAXBElement.

See gh-30552
See gh-32972
Closes gh-32977
2024-06-07 14:13:59 +02:00
Sébastien Deleuze 20d23584f6 Merge branch '6.1.x' 2024-06-07 13:45:19 +02:00