Commit Graph

901 Commits

Author SHA1 Message Date
Sam Brannen 7d628b6298 Polish Resilience Features section of reference manual 2025-07-15 10:39:49 +02:00
Sam Brannen dbe89abd7b Pause unused application contexts in the TestContext framework
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Since the introduction of the Spring TestContext Framework in 2007,
application contexts have always been stored in the context cache in a
"running" state. However, leaving a context running means that
components in the context may continue to run in the background. For
example, JMS listeners may continue to consume messages from a queue;
scheduled tasks may continue to perform active work, etc.; and this can
lead to issues within a test suite.

To address such issues, this commit introduces built-in support for
pausing application contexts when they are not in use and restarting
them if they are needed again.

Specifically, the TestContextManager now marks a test's application
context as "unused" after execution of the test class has ended, and
the underlying ContextCache then "stops" the application context if no
other test class is currently using the context. When a
TestExecutionListener later attempts to obtain a paused application
context -- for example, for a subsequent test class that shares the
same application context -- the ContextCache ensures that context is
restarted before returning it.

See https://github.com/spring-projects/spring-boot/issues/28312
See gh-35171
Closes gh-35168
2025-07-14 18:29:02 +02:00
Sam Brannen f3757cedb9 Polish context caching section 2025-07-14 18:27:01 +02:00
Juergen Hoeller 22a23322f3 Polishing
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-07-10 20:05:47 +02:00
Juergen Hoeller 4ca8a8abbe Merge branch '6.2.x'
# Conflicts:
#	framework-docs/modules/ROOT/pages/core/null-safety.adoc
#	framework-docs/modules/ROOT/pages/core/validation/error-code-resolution.adoc
#	framework-docs/modules/ROOT/pages/integration/cds.adoc
#	framework-docs/modules/ROOT/pages/integration/jms/sending.adoc
#	framework-docs/modules/ROOT/pages/integration/rest-clients.adoc
#	framework-docs/modules/ROOT/pages/languages/kotlin/bean-definition-dsl.adoc
#	framework-docs/modules/ROOT/pages/languages/kotlin/null-safety.adoc
#	framework-docs/modules/ROOT/pages/languages/kotlin/web.adoc
#	framework-docs/modules/ROOT/pages/web/webflux/config.adoc
#	framework-docs/modules/ROOT/pages/web/webflux/controller/ann-requestmapping.adoc
#	framework-docs/modules/ROOT/pages/web/webmvc/mvc-http2.adoc
2025-07-10 19:42:14 +02:00
Juergen Hoeller a0c083619f Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
Juergen Hoeller 481a74a202 Add reference documentation for @Retryable and @ConcurrencyLimit
See gh-35133
See gh-34529
2025-07-10 17:14:08 +02:00
Juergen Hoeller 200934c673 Add reference documentation for JmsClient next to JmsTemplate
See gh-32501
2025-07-10 17:13:58 +02:00
Sam Brannen 440bf94cee Improve URLs in Validation chapter of the reference manual
In order to improve the user experience with URLs for sections of the
Validation chapter, this commit makes the following changes to page
names in the "validation" folder.

- beans-beans.html --> data-binding.html

- conversion.html --> error-code-resolution.html

Some of the section anchors in data-binding.html have also been
renamed. For example, #beans-beans is now #data-binding-property-binding.

Closes gh-35181
2025-07-10 14:03:28 +02:00
Sam Brannen cc59acb7ab Fix type conversion example 2025-07-10 12:16:50 +02:00
Sam Brannen 7d394a0564 Merge branch '6.2.x' 2025-07-10 11:53:38 +02:00
Sam Brannen 983fdebdbb Document how to register runtime hints for convention-based conversion
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-35178
2025-07-10 11:51:13 +02:00
Sam Brannen e3445b17a7 Improve Conversion section of ref docs 2025-07-10 11:51:13 +02:00
Sam Brannen 40f9ac58d2 Further polishing of AOT section 2025-07-10 11:51:13 +02:00
Sébastien Deleuze 197de07634 Document a NullAway limitation 2025-07-10 10:52:38 +02:00
Sam Brannen 78bf41ca83 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-07-09 17:41:53 +02:00
Sam Brannen 95ad25ebf2 Polish AOT section of the reference docs
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-07-09 17:39:29 +02:00
Sébastien Deleuze 2d7323bb7f Update Spring MVC message converters documentation
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-35166
2025-07-07 18:15:44 +02:00
rstoyanchev 1982c7e020 Support 404 handling for HttpExchange interfaces
Closes gh-32105
2025-07-07 09:12:22 +01:00
Sam Brannen 27072ccb87 Improve wording 2025-07-03 14:17:43 +02:00
rstoyanchev 26d413c521 Update router function docs for API versioning
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-35113
2025-07-02 15:09:32 +01:00
Sébastien Deleuze 701e034c0e Improve null-safety documentation related to TYPE_USE
This commit refines the null-safety documentation to document more
explicitly the code style guidelines related to
`@Target(ElementType.TYPE_USE)`.

Closes gh-35098
2025-07-02 15:28:51 +02:00
Juergen Hoeller 0bee65482f Document actual status of orm.hibernate5 and Hibernate JPA support
See gh-35111
2025-06-25 18:59:06 +02:00
Juergen Hoeller d47f1a1749 Migrate orm.hibernate5 to orm.jpa.hibernate package for Hibernate ORM 7.0
Closes gh-35111
2025-06-25 18:07:15 +02:00
rstoyanchev 40eb9c2c81 Add docs for API version deprecation support
Closes gh-35049
2025-06-25 12:03:35 +01:00
rstoyanchev 3cb8a833e4 Polishing API versioning ref docs 2025-06-25 12:03:35 +01:00
Sam Brannen ad2b7f4d01 Merge branch '6.2.x' 2025-06-25 10:23:28 +02:00
Sam Brannen 2477544a8f Polishing 2025-06-25 10:22:47 +02:00
Tran Ngoc Nhan abbd4ebcf6 Link to @⁠ContextConfiguration Javadoc from reference manual
Closes gh-35088

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-06-25 10:16:24 +02:00
Sébastien Deleuze ba9bef6bbf Upgrade to Kotlin 2.2.0
Kotlin 2.2 is the new baseline for Spring Framework 7.0.

-Xannotation-default-target=param-property is specified to avoid
warnings when compiling tests or documentation snippets. It is
expected to become the default behavior in an upcoming version
of Kotlin, see https://youtrack.jetbrains.com/issue/KT-73255 for
more details.

Closes gh-34453
2025-06-23 18:11:06 +02:00
Yanming Zhou d8ac3ff31f Fix typo in WebMvc.fn document
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-35045

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-06-13 10:03:07 +02:00
rstoyanchev 6c27dbc095 Merge branch '6.2.x' 2025-06-06 15:28:43 +01:00
rstoyanchev c769f43b3e Update docs on testing client code
Closes gh-34892
2025-06-06 15:28:28 +01:00
rstoyanchev 4782c697b8 Improve RestControllerAdvice documentation
Closes gh-34866
2025-06-06 15:28:28 +01:00
rstoyanchev de52090959 Polishing contribution
Closes gh-34554
2025-06-06 15:28:28 +01:00
Jimmy Axenhus fa781c8390 Correct name of Selenium WebDriver artifact
The selenium-htmlunit3-driver artifact does not exist.

Closes gh-34840

Signed-off-by: Jimmy Axenhus <github@axenhus.com>
2025-06-06 15:28:28 +01:00
rstoyanchev 9f7a321c44 Support streaming with HTTP interfaces + RestClient
Closes gh-32358
2025-06-05 17:07:01 +01:00
rstoyanchev 263af04508 Polishing contribution
Closes gh-34877
2025-06-04 13:46:22 +01:00
kssumin 8b9ae2b11c Update Jetty on WebFlux bootstrap in reference docs
Replace deprecated JettyHttpHandlerAdapter with JettyCoreHttpHandlerAdapter
Update example to work with Jetty 12+
Add note about the deprecation

See gh-34877

Signed-off-by: kssumin <201566@jnu.ac.kr>
2025-06-04 13:46:22 +01:00
rstoyanchev b699b65b40 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-03 19:11:52 +01:00
rstoyanchev be17315f63 Add mention of CompletionStage in "Async Requests"
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-34991
2025-06-03 19:10:03 +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
Sam Brannen 941b791669 Polish null-safety documentation 2025-06-03 13:44:35 +02:00
Sébastien Deleuze 0b14d676cc Refine null-safety documentation terms
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-34982
2025-06-02 23:42:33 +02:00
Sam Brannen 0d39bb828a Merge branch '6.2.x' 2025-06-02 16:30:57 +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
rstoyanchev a16cdd2c41 Fix typo in reference docs 2025-06-02 12:38:19 +01:00
rstoyanchev d1e279f060 Add reference docs for HTTP Service config
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-34912
2025-06-02 10:40:09 +01:00
rstoyanchev 81626b0734 Polishing reference docs for HTTP Service clients
See gh-34912
2025-06-02 10:40:09 +01:00
Sam Brannen 5e9f90f9bf Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
2025-05-31 12:17:47 +02:00
Aurh1l aea66265f7 Fix syntax in @⁠SqlGroup example
Backport Bot / build (push) Has been cancelled Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
Closes gh-34972
2025-05-31 12:15:50 +02:00
Sam Brannen 24facbc002 Document that JUnit 4 is officially in maintenance mode (as of today) 2025-05-30 14:37:58 +02:00
Sam Brannen 0f9870b603 Stop referring to JUnit 5 in documentation
Closes gh-34970
2025-05-30 14:37:05 +02:00
Sam Brannen 21f235c093 Merge branch '6.2.x' 2025-05-28 16:41:58 +02:00
Dhruv 562157d2c0 Update X-Forwarded-Proto doc to say "https / http"
Backport Bot / build (push) Has been cancelled Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
Closes gh-34959

Signed-off-by: Dhruv <dhruv2015@hotmail.co.uk>
2025-05-28 16:41:16 +02:00
rstoyanchev 26ee30ed8f Merge branch '6.2.x' 2025-05-28 11:10:06 +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
Sébastien Deleuze 59299b9e15 Fix a typo in null-safety.adoc 2025-05-27 09:36:21 +02:00
rstoyanchev e04de95ef2 Update API versioning ref docs for client side
Closes: gh-34569
2025-05-14 13:01:30 +01:00
rstoyanchev 5cb3ea228e Polishing in RestClient reference docs 2025-05-14 13:01:30 +01:00
rstoyanchev cce2771639 Add API versioning reference documentation
See gh-34569
2025-05-14 13:01:30 +01:00
Sam Brannen 680094d74e Merge branch '6.2.x' 2025-05-13 13:45:37 +02:00
Sam Brannen 03ae97b2eb Introduce Spring property for default escape character for placeholders
Spring Framework 6.2 introduced support for an escape character for
property placeholders (by default '\'). However, as of Spring Framework
6.2.6, there was no way to either escape the escape character or disable
escape character support.

For example, given a `username` property configured with the value of
`Jane.Smith` and a `DOMAIN\${username}` configuration string, property
placeholder replacement used to result in `DOMAIN\Jane.Smith` prior to
6.2 but now results in `DOMAIN${username}`. Similarly, an attempt to
escape the escape character via `DOMAIN\\${username}` results in
`DOMAIN\${username}`.

In theory, one should be able to disable use of an escape character
altogether, and that is currently possible by invoking
setEscapeCharacter(null) on AbstractPropertyResolver and
PlaceholderConfigurerSupport (the superclass of
PropertySourcesPlaceholderConfigurer).

However, in reality, there are two hurdles.

- As of 6.2.6, an invocation of setEscapeCharacter(null) on a
  PropertySourcesPlaceholderConfigurer applied to its internal
  top-level PropertySourcesPropertyResolver but not to any nested
  PropertySourcesPropertyResolver, which means that the `null` escape
  character could not be effectively applied.

- Users may not have an easy way to explicitly set the escape character
  to `null` for a PropertyResolver or
  PropertySourcesPlaceholderConfigurer. For example, Spring Boot
  auto-configures a PropertySourcesPlaceholderConfigurer with the
  default escape character enabled.

This first issue above has recently been addressed by gh-34861.

This commit therefore addresses the second issue as follows.

- To allow developers to easily revert to the pre-6.2 behavior without
  changes to code or configuration strings, this commit introduces a
  `spring.placeholder.escapeCharacter.default` property for use with
  SpringProperties which globally sets the default escape character that
  is automatically configured in AbstractPropertyResolver and
  PlaceholderConfigurerSupport.

- Setting the property to an empty string sets the default escape
  character to `null`, effectively disabling the default support for
  escape characters.

    spring.placeholder.escapeCharacter.default =

- Setting the property to any other character sets the default escape
  character to that specific character.

    spring.placeholder.escapeCharacter.default = ~

- Setting the property to a string containing more than one character
  results in an exception.

- Developers are still able to configure an explicit escape character
  in AbstractPropertyResolver and PlaceholderConfigurerSupport if they
  choose to do so.

- Third-party components that wish to rely on the same feature can
  invoke AbstractPropertyResolver.getDefaultEscapeCharacter() to obtain
  the globally configured default escape character.

See gh-9628
See gh-34315
See gh-34861
Closes gh-34865
2025-05-13 13:37:30 +02:00
Sam Brannen 2018d933ac Merge branch '6.2.x' 2025-05-10 15:11:44 +02:00
Sam Brannen 457e876303 Polish reference manual regarding placeholders 2025-05-10 15:10:29 +02:00
Sam Brannen c74fc7ec90 Deprecate JUnit 4 support in the TestContext framework
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
Closes gh-34794
2025-04-26 10:06:18 +02:00
Sam Brannen 2db1a63a92 Merge branch '6.2.x' 2025-04-26 09:41:09 +02:00
Sam Brannen ef34464c94 Restructure TestContext framework support sections
Backport Bot / build (push) Has been cancelled Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
This commit moves the JUnit Jupiter section above the JUnit 4 section
and groups all JUnit 4 sections under a new "JUnit 4 Support" heading.
2025-04-26 09:38:10 +02:00
Sam Brannen 23aea5c402 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-04-14 11:32:48 +02:00
Sam Brannen f27382cfb6 Consistently indent code with tabs in reference manual 2025-04-14 11:22:08 +02:00
Sam Brannen 6bc196883a Fix heading for "Context Configuration with Context Customizers" 2025-04-14 11:22:08 +02:00
Sam Brannen df4868bf83 Merge branch '6.2.x' 2025-04-10 16:49:43 +02:00
Sam Brannen 3f9402a56b Update testing documentation to reflect status quo 2025-04-10 15:06:52 +02:00
Sam Brannen 1795b234e4 Merge branch '6.2.x' 2025-04-10 14:52:22 +02:00
Sam Brannen c168e1c297
Provide first-class support for Bean Overrides with @⁠ContextHierarchy
This commit provides first-class support for Bean Overrides
(@⁠MockitoBean, @⁠MockitoSpyBean, @⁠TestBean, etc.) with
@⁠ContextHierarchy.

Specifically, bean overrides can now specify which ApplicationContext
they target within the context hierarchy by configuring the
`contextName` attribute in the annotation. The `contextName` must match
a corresponding `name` configured via @⁠ContextConfiguration.

For example, the following test class configures the name of the second
hierarchy level to be "child" and simultaneously specifies that the
ExampleService should be wrapped in a Mockito spy in the context named
"child". Consequently, Spring will only attempt to create the spy in
the "child" context and will not attempt to create the spy in the
parent context.

@⁠ExtendWith(SpringExtension.class)
@⁠ContextHierarchy({
    @⁠ContextConfiguration(classes = Config1.class),
    @⁠ContextConfiguration(classes = Config2.class, name = "child")
})
class MockitoSpyBeanContextHierarchyTests {

    @⁠MockitoSpyBean(contextName = "child")
    ExampleService service;

    // ...
}

See gh-33293
See gh-34597
See gh-34726
Closes gh-34723

Signed-off-by: Sam Brannen <104798+sbrannen@users.noreply.github.com>
2025-04-10 14:46:50 +02:00
Sébastien Deleuze 98de16bc50 Turn CDS documentation into a JVM AOT cache one
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
This commit evolves the CDS documentation to a JVM AOT cache
one for Java 24+, while still documenting how to use CDS for
Java 17 to Java 23.

Closes gh-34700
2025-04-03 17:55:42 +02:00
Sébastien Deleuze e9c4665a80 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-04-02 18:05:04 +02:00
Taeik Lim a946fe2bf8 Fix broken link for Server-Sent Events
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Signed-off-by: Taeik Lim <sibera21@gmail.com>
Closes gh-34705
2025-04-02 17:43:42 +02:00
Juergen Hoeller a122dda596 Merge branch '6.2.x' 2025-03-31 16:42:29 +02:00
Juergen Hoeller 3ddc607b3e Add spring.locking.strict property to common appendix
See gh-34303
2025-03-31 16:38:28 +02:00
Tobias Hänel f8a3077da9 Fix typo in Bean Validation section of reference manual
This commit fixes a minor typo in  the "Java Bean Validation - Customizing
Validation Errors" section of the reference manual.

Closes gh-34686

Signed-off-by: Tobias Hänel <contact@tobias-haenel.de>
2025-03-31 11:55:30 +02:00
Tobias Hänel a63c5ad305
Fix typo in Bean Validation section of reference manual
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
This commit fixes a minor typo in  the "Java Bean Validation - Customizing
Validation Errors" section of the reference manual.

Closes gh-34686

Signed-off-by: Tobias Hänel <contact@tobias-haenel.de>
2025-03-30 20:28:12 +02:00
Tran Ngoc Nhan 7c3913050a Fix formatting and update links to scripting libraries and HDIV
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-34603

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Co-authored-by: Sam Brannen <104798+sbrannen@users.noreply.github.com>
(cherry picked from commit 666e2df0f3)
2025-03-15 13:51:28 +01:00
Tran Ngoc Nhan 666e2df0f3
Fix formatting and update links to scripting libraries and HDIV
Closes gh-34603

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Co-authored-by: Sam Brannen <104798+sbrannen@users.noreply.github.com>
2025-03-15 13:49:32 +01:00
Brian Clozel 4724020174 Merge branch '6.2.x' 2025-03-13 15:26:47 +01:00
Brian Clozel 0f83c483bb Remove invalid link from reference documentation
Closes gh-34593
2025-03-13 15:26:09 +01:00
Sam Brannen 68fce29ae9 Support Optional with null-safe and Elvis operators in SpEL expressions
This commit introduces null-safe support for java.util.Optional in the
following SpEL operators:

- PropertyOrFieldReference
- MethodReference
- Indexer
- Projection
- Selection
- Elvis

Specifically, when a null-safe operator is applied to an empty
`Optional`, it will be treated as if the `Optional` were `null`, and
the subsequent operation will evaluate to `null`. However, if a
null-safe operator is applied to a non-empty `Optional`, the subsequent
operation will be applied to the object contained in the `Optional`,
thereby effectively unwrapping the `Optional`.

For example, if `user` is of type `Optional<User>`, the expression
`user?.name` will evaluate to `null` if `user` is either `null` or an
empty `Optional` and will otherwise evaluate to the `name` of the
`user`, effectively `user.get().getName()` for property access.

Note, however, that invocations of methods defined in the `Optional`
API are still supported on an empty `Optional`. For example, if `name`
is of type `Optional<String>`, the expression `name?.orElse('Unknown')`
will evaluate to "Unknown" if `name` is an empty `Optional` and will
otherwise evaluate to the `String` contained in the `Optional` if
`name` is a non-empty `Optional`, effectively `name.get()`.

Closes gh-20433
2025-03-12 14:53:06 +01:00
Sam Brannen 1780e30a43 Polish documentation for SpEL Elvis operator 2025-03-12 14:52:57 +01:00
Sam Brannen 2c05e991b5 Revise SpEL internals and documentation
This is a prerequisite for null-safe Optional support.

See gh-20433
2025-03-12 13:59:26 +01:00
Sam Brannen d3d951e44b Improve documentation for SpEL Elvis operator 2025-03-12 13:35:41 +01:00
Juergen Hoeller c74f897fac Merge branch '6.2.x'
# Conflicts:
#	spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
2025-03-08 12:23:43 +01:00
Juergen Hoeller 5877a38fa1 Add explicit note on JSpecify support in Spring Framework 6.2 vs 7.0
Closes gh-34551
2025-03-08 12:21:46 +01:00
Sam Brannen 15a71f94fb Merge branch '6.2.x' 2025-03-07 13:38:50 +01:00
Vedran Pavic 94d29bac9f Fix typo in Spring MVC error responses documentation
Closes gh-34552

Signed-off-by: Vedran Pavic <vedran@vedranpavic.com>
2025-03-07 13:37:57 +01:00
Sébastien Deleuze fda9b9a696 Polishing
See gh-18353
2025-03-07 09:00:06 +01:00
Sébastien Deleuze bedc235bab Document programmatic bean registration
This commit adds the reference documentation for the new programmatic
bean registration capabilities for both Java and Kotlin.

Closes gh-18353
2025-03-06 19:15:56 +01:00
Sam Brannen 52e01bbb62 Merge branch '6.2.x' 2025-03-06 13:31:46 +01:00
Sam Brannen 0fd94f1b9f Polishing 2025-03-06 13:30:20 +01:00