Commit Graph

26656 Commits

Author SHA1 Message Date
Andrey Somov 097758baf3 Upgrade to SnakeYAML 2.0
This commit raises the SnakeYAML baseline version to 2.0.
While most Spring applications are not affected by CVE-2022-1471,
upgrading this version should prevent automated tools from raising this
as a security issue. Such tools usually do not understand that YAML
parsing in Spring is about reading configuration, not parsing untrusted
content.

Closes gh-30048
2023-05-22 14:31:27 +02:00
Brian Clozel 96a429a561 Move reactive server instrumentation out of WebFilter
Prior to this commit, the Observation instrumentation for Reactive
server applications was implemented with a `WebFilter`. This allowed to
record observations and set up a tracing context for the controller
handlers.

The limitation of this approach is that all processing happening at a
lower level is not aware of any observation. Here, the
`HttpWebHandlerAdapter` handles several interesting aspects:

* logging of HTTP requests and responses at the TRACE level
* logging of client disconnect errors
* handling of unresolved errors

With the current instrumentation, these logging statements will miss the
tracing context information. As a result, this commit deprecates the
`ServerHttpObservationFilter` in favor of a more direct instrumentation
of the `HttpWebHandlerAdapter`. This enables a more precise
instrumentattion and allows to set up the current observation earlier in
the reactor context: log statements will now contain the relevant
information.

Fixes gh-30013
2023-05-22 11:03:02 +02:00
greg.lee e5ee369e70 Introduce method in MockHttpServletRequestBuilder to set remote address
Co-authored-by: Sam Brannen <sam@sambrannen.com>
Closes gh-30497
2023-05-16 17:30:48 +02:00
Simon Baslé f5bc084ce2 Merge branch '6.0.x' (javadoc changes) 2023-05-16 15:05:42 +02:00
Simon Baslé 1721e42988 Remove JBossAS catch-all javadoc external link
This commit removes the JBoss Application Server external javadoc link,
which covers too many packages and can thus problematically take
precedence for said packages and lead to dead links.

It is replaced by Hibernate javadocs for `org.hibernate.*` packages,
JakartaEE and jsr305 for annotations. We lose a limited number of links
around org.xnio classes and Hibernate-and-JTA-related classes, as a
trade-off.

See gh-30455
See gh-30428
2023-05-16 15:04:34 +02:00
Simon Baslé eabb846d07 Improve how the build deals with javadoc invalid references
This commit improves how the build deals with javadoc invalid references
in two ways.

Link/see references that are temporarily invalid during javadoc
generation of individual modules are better masked by using the option
`Xdoclint:syntax` instead of `Xdoclint:none` (warnings were still
visible in some cases, e.g. when individually building the javadoc for
a specific module).

Global javadoc-building task `api` now combines `syntax` and `reference`
`Xdoclint` groups, allowing to raise truly invalid references even when
all the modules have been aggregated.

This commit also fixes the 20+ errors which appeared following the later
change in doclet configuration.

Closes gh-30428
2023-05-16 15:04:10 +02:00
Sam Brannen d86cfc949d Polishing 2023-05-15 16:07:15 +02:00
Sam Brannen 1d708510df Merge branch '6.0.x' 2023-05-15 15:23:16 +02:00
Jan Mewes 280b0de646 Docs: Remove duplicate in SpEL feature list
Closes gh-30404
2023-05-15 15:22:44 +02:00
Sam Brannen 1275b10d9c Merge branch '6.0.x' 2023-05-15 15:09:56 +02:00
Sam Brannen 2738b3e50f Polishing
See gh-30482
2023-05-15 15:09:06 +02:00
Anyuruf 169795d673 Fix wording in r2dbc Statement Filters section of ref docs
Co-authored-by: Sam Brannen <sam@sambrannen.com>
Closes gh-30482
2023-05-15 15:08:58 +02:00
Sébastien Deleuze 1f3dd3e2ee Merge branch '6.0.x' 2023-05-15 11:49:31 +02:00
Sébastien Deleuze 085565a771 Skip class transformer in PersistenceUnitInfoDescriptor for native images
In order to restore native support with Hibernate 6.2, this
change updates the PersistenceUnitInfoDescriptor instance
created by SpringHibernateJpaPersistenceProvider in order to
skip the class transformer for native images.

Closes gh-30492
2023-05-15 11:48:56 +02:00
Sam Brannen c227fbfdf2 Reorganize helper methods to align with first usage principle 2023-05-13 19:29:48 +02:00
Sam Brannen f3f3dc693a Fix logic for validating @RecordApplicationEvents config
Prior to this commit, the SpringExtension looked up the
TestInstance.Lifecycle and ExecutionMode using
TestContextAnnotationUtils; however, using TestContextAnnotationUtils is
problematic since the TestInstance.Lifecycle and ExecutionMode can be
configured globally via configuration parameters instead of locally via
the @TestInstance and @Execution annotations.

This commit addresses these issues by looking up the
TestInstance.Lifecycle and ExecutionMode via JUnit Jupiter's
ExtensionContext which takes into account both global and local
configuration.

See gh-30020
2023-05-13 19:27:46 +02:00
Sam Brannen 5e1a4740d7 Suppress unused warning in test 2023-05-13 18:49:44 +02:00
Brian Clozel b4866e51b2 Configure toolchain locations when building PRs
This commit updates the script that builds PRs to add locations to the
installed JDK within the CI image. Without this change, PRs fail to
build because of the recently introduced JDK21 toolchain requirement in
the Spring Framework build.

Closes gh-30472
2023-05-12 11:33:17 +02:00
rstoyanchev a9fa813a75 Merge branch '6.0.x' 2023-05-12 10:20:11 +01:00
rstoyanchev 806519f78a Comment out check->antora dependency
See gh-30481
2023-05-12 10:19:52 +01:00
Sébastien Deleuze d99c2cf31e Refine JVM checkpoint/restore support
This commit:
 - Refine the wording used in logs and Javadoc
 - Avoid calling awaitPreventShutdownBarrier() in afterRestore()
 - Add logs to print the restart duration

See gh-29921
2023-05-12 09:29:35 +02:00
Stephane Nicoll ffa431da7b Merge branch '6.0.x' 2023-05-12 08:59:57 +02:00
Stephane Nicoll c3c5eaf914 Align AOT contributions for injection with the runtime behavior
Bean post processors that use InjectionMetadata checks if a property
value for the element it is about to inject is set and skip it, so
that the property value is used. Previously, the AOT contribution for
the same behavior did not check if a matching property value is set
and therefore override the user-defined value.

This commit introduces an additional method that filters the injected
element list so that only the elements that should be processed are
defined.

Closes gh-30476
2023-05-12 08:49:22 +02:00
Brian Clozel a91effcd86 Ignore some FreeMarker tests for JDK21
This reverts commit 07a5d8c91 and instead disables the relevant
FreeMarker tests for JDK21+ runs.
2023-05-11 18:00:23 +02:00
Brian Clozel 07a5d8c91c Fix FreeMarker tests for JDK21 build
Prior to this commit, some FreeMarker tests would fail when involving
property lookup in a template file, where this bean property is linked
with a method implemented as a default method on an interface.

While I did not manage to reproduce this behavior in an independent test
case, this is most likely related to a change in JDK 21:
https://bugs.openjdk.org/browse/JDK-8071693

This commit changes the template expression to using the default method
directly.
2023-05-11 17:10:26 +02:00
Stephane Nicoll 0bd0578ff9 Merge branch '6.0.x' 2023-05-11 16:36:38 +02:00
Stephane Nicoll a9b94241af Fix typo
Closes gh-30473
2023-05-11 16:35:20 +02:00
Brian Clozel 2f3a73a59e Merge branch '6.0.x' 2023-05-11 15:28:30 +02:00
Spring Builds 7066dc4ba7 Next development version (v6.0.10-SNAPSHOT) 2023-05-11 12:47:00 +00:00
Juergen Hoeller 1e74d793a2 Merge branch '6.0.x' 2023-05-10 18:51:40 +02:00
Juergen Hoeller 3f889e997c Clarify RootBeanDefinition vs GenericBeanDefinition
Closes gh-30444
2023-05-10 18:50:27 +02:00
Juergen Hoeller 6622a3c7d6 Consistent package-info declarations for CGLIB fork
Closes gh-30461
2023-05-10 18:50:17 +02:00
rstoyanchev 3d96e3f8c8 Merge branch '6.0.x' 2023-05-10 17:39:56 +01:00
Rob Winch d8f6567c89 Download the playbook to build dir
Closes gh-30465
2023-05-10 17:39:40 +01:00
Sam Brannen d8215a62f6 Merge branch '6.0.x' 2023-05-10 17:40:42 +02:00
Sam Brannen 111309605c Support Test AOT processing with GraalVM tracing agent and NBT
Prior to this commit, test AOT processing failed when using the GraalVM
tracing agent and GraalVM Native Build Tools (NBT) plugins for Maven
and Gradle.

The reason is that the AOT support in the TestContext framework (TCF)
relied on AotDetector.useGeneratedArtifacts() which delegates
internally to NativeDetector.inNativeImage() which does not
differentiate between values stored in the
"org.graalvm.nativeimage.imagecode" JVM system property.

This commit addresses this issue by introducing a TestAotDetector
utility that is specific to the TCF. This detector considers the
current runtime to be in "AOT runtime mode" if the "spring.aot.enabled"
Spring property is set to "true" or the GraalVM
"org.graalvm.nativeimage.imagecode" JVM system property is set to any
non-empty value other than "agent".

Closes gh-30281
2023-05-10 17:39:46 +02:00
Sam Brannen 89bcee68bb Add author tag 2023-05-10 17:39:46 +02:00
Juergen Hoeller 841124af75 Merge branch '6.0.x' 2023-05-10 17:19:39 +02:00
Juergen Hoeller c8927ae753 Polishing 2023-05-10 17:18:31 +02:00
Juergen Hoeller e228f4ba64 Consistent pre-resolution of event type vs payload type
Restores proper event type propagation to parent context.
Selectively applies payload type to given payload object.
Also reuses cached type for regular ApplicationEvent now.

Closes gh-30360
2023-05-10 17:17:48 +02:00
Simon Baslé dbc42f56b3 Merge branch '6.0.x' 2023-05-10 15:18:57 +02:00
Simon Baslé c733ae0f22 Fix ApplicationListenerMethodAdapter#supportsEventType check
This commit fixes the check by avoiding a fallback to eventType's
hasUnresolvableGenerics(). This could previously lead to checking a
generic event type `A<T>` against a listener which accepts unrelated
`B` and return `true` despite the inconsistency.

Note that this wouldn't necessarily surface to the user because there is
a `catch (ClassCastException e)` down the line, which was primarily put
in place to deal with lambda-based listeners but happens to catch an
exception thrown due to the bad result of `supportsEventType`.

The `supportsEventType` now matches generic `PayloadApplicationEvent`
types with a raw counterpart, using the above fallback only in that case
and otherwise ultimately returning `false`.

Closes gh-30399
2023-05-10 15:00:11 +02:00
Sam Brannen 96fbcb26c9 Merge branch '6.0.x' 2023-05-10 14:36:09 +02:00
Sam Brannen aefcb9d2d6 Make maximum SpEL expression length configurable
Closes gh-30380
2023-05-10 14:35:36 +02:00
Sam Brannen 6a6dd599a1 Remove duplicate Checkstyle suppressions 2023-05-10 14:31:24 +02:00
Sam Brannen 5e52259fb3 Suppress warnings in tests 2023-05-10 14:27:43 +02:00
Sam Brannen e51c71bcd6 Delete unused code 2023-05-10 14:26:41 +02:00
Stephane Nicoll 4d5e235166 Merge branch '6.0.x' 2023-05-10 13:55:36 +02:00
Stephane Nicoll 120c228b70 Handle injection of several persistence units
This commit adapts the generated code so that each injection point has
a dedicated namespace in the form of a private method. That prevents
the same variable to be reused twice which lead to a compilation failure
previously.

Closes gh-30437
2023-05-10 13:55:26 +02:00
rstoyanchev 5236d17ac4 Re-enable flaky tests after bd66c70b
See gh-29287
2023-05-10 11:44:32 +01:00