Compare commits

...

821 Commits

Author SHA1 Message Date
Stéphane Nicoll 6b117247d3 Release v6.2.18 2026-04-17 08:26:24 +02:00
Juergen Hoeller f6671e77e2 Upgrade to Reactor 2024.0.17 and Micrometer 1.15.11
Closes gh-36660
Closes gh-36661
2026-04-16 23:47:49 +02:00
rstoyanchev b338fdd99d Add doOnDiscard in MultipartHttpMessageReader
Closes gh-36563
2026-04-16 21:19:13 +01:00
Sam Brannen 4e3f264f34 Add missing tests for WebRequestDataBinder
See gh-36625

(cherry picked from commit 63817ce202)
2026-04-16 16:36:27 +02:00
Sam Brannen 9e0b83ead3 Polish WebRequestDataBinderTests
(cherry picked from commit 61bd79017f)
2026-04-16 16:36:18 +02:00
Sam Brannen af4b1229a5 Extract ServletRequestParameterPropertyValuesTests
(cherry picked from commit c9b88b4ebd)
2026-04-16 15:08:23 +02:00
Sam Brannen 623ccd1a4f Revise "Skip binding entirely when field is not allowed"
This commit reverts the changes made to WebDataBinder's doBind()
implementation in e4d03f6625 and instead implements the skipping logic
directly in checkFieldDefaults(), checkFieldMarkers(), and
adaptEmptyArrayIndices() by preemptively checking if the corresponding
field is allowed.

This commit also improves the Javadoc and adds missing tests.

See gh-36625
Fixes gh-36627

(cherry picked from commit 68c575ab14)
2026-04-16 15:08:09 +02:00
Sam Brannen 69068ba33d Further clarify semantics of HttpMethod.valueOf()
See gh-36652

(cherry picked from commit cb320468db)
2026-04-14 16:19:43 +02:00
angry2.k f182f9a76b Clarify semantics of HttpMethod.valueOf()
HttpMethod.valueOf() performs a case-sensitive lookup of predefined
HttpMethod constants. For example, valueOf("GET") resolves to
HttpMethod.GET, whereas valueOf("get") results in a newly created
HttpMethod instance.
Update the Javadoc to explicitly document this behavior.

See gh-36642
Closes gh-36652

Signed-off-by: angry-2k <edkev@kakao.com>

(cherry picked from commit df828458fa)
2026-04-14 16:19:35 +02:00
Sam Brannen 9d144487e7 Improve SpEL tests for Elvis and Ternary operators
(cherry picked from commit 21f3b964fe)
2026-04-12 14:31:15 +02:00
Sébastien Deleuze b07bc2cb99 Apply nullable value class fix to InvocableHandlerMethod
See gh-36643
2026-04-10 16:24:36 +02:00
T45K 57d4765131 Fix nullable value class handling in CoroutinesUtils
Closes gh-36643
Signed-off-by: T45K <tasktas9@gmail.com>
2026-04-10 16:22:55 +02:00
Brian Clozel cbdec804a5 Allow null id/event in ServerSentEvent
The builder itself does not allow `null` values so this shouldn't be
necessary, but because the offending change was introduced late in the
6.2.x line, we'll be more flexible here.

Fixes gh-36634
2026-04-10 14:43:29 +02:00
Sam Brannen 438b1011fe Revise documentation for @⁠ActiveProfiles and ActiveProfilesResolver
See gh-36269
See gh-36600

(cherry picked from commit 99b78adce3)
2026-04-09 12:59:42 +02:00
Mohak-Nagaraju c5e560574c Document that spring.profiles.active is ignored by @⁠ActiveProfiles
The Spring TestContext Framework does not honor the
`spring.profiles.active` system property when determining
active profiles for a test class if @⁠ActiveProfiles is
used.

This commit documents that behavior in the @⁠ActiveProfiles
and DefaultActiveProfilesResolver Javadoc, as well as in
the reference manual. A SystemPropertyActiveProfilesResolver
example is also added showing how to allow
`spring.profiles.active` to override @⁠ActiveProfiles.

See gh-36269
Closes gh-36600

Signed-off-by: Mohak Nagaraju <98132980+Mohak-Nagaraju@users.noreply.github.com>
(cherry picked from commit 644731c9f6)
2026-04-09 12:59:34 +02:00
Brian Clozel 589e58e400 Skip binding entirely when field is not allowed
Prior to this commit, fields that are not allowed for binding were
always skipped and would not be bound. But the field and default marker
support (with the "_" and "!" prefixes) would be still considered and
could trigger collection instantiation/autogrow.

While this does not cause unwanted binding, this allocates memory for no
reason. This commit revisits the binding algorithm to only consider
default and field marker support if the regular field is allowed.

Fixes gh-36627
2026-04-09 11:06:46 +02:00
Sam Brannen 6101419d80 Support @⁠Sql with DataSource wrapped in a TransactionAwareDataSourceProxy
Prior to this commit, SqlScriptsTestExecutionListener unwrapped data
sources wrapped in an InfrastructureProxy or a scoped proxy, but it did
not unwrap a data source wrapped in a TransactionAwareDataSourceProxy.
Consequently, the sameDataSource() check failed in the latter case,
preventing execution of @⁠Sql scripts.

To address that, this commit revises sameDataSource() to unwrap a
TransactionAwareDataSourceProxy as well, analogous to the
implementations of setDataSource() in DataSourceTransactionManager,
JpaTransactionManager, and HibernateTransactionManager.

Closes gh-36611

(cherry picked from commit 6251b2c0c9)
2026-04-09 10:36:55 +02:00
Juergen Hoeller 63cd96fa5f Revise target bean exception with consistent message formatting 2026-04-08 15:48:17 +02:00
Juergen Hoeller 923ec6a8e1 Upgrade to Groovy 4.0.31 and Mockito 5.23 2026-04-08 15:09:57 +02:00
Juergen Hoeller 241a7dca02 Polishing
(cherry picked from commit 1687d90a8c)
2026-04-08 15:09:33 +02:00
Juergen Hoeller d675132ac0 Improve SpringValidatorAdapter and MethodValidationAdapter performance
Closes gh-36621

(cherry picked from commit b8f1005897)
2026-04-08 13:57:27 +02:00
Juergen Hoeller 2801c7e23e Avoid MessageFormat rendering for exception messages in binding errors
Closes gh-36609

(cherry picked from commit 0150c4ba06)
2026-04-08 13:57:22 +02:00
Sam Brannen d356e7a238 Improve Javadoc for MergedAnnotations
(cherry picked from commit b560c7b85d)
2026-04-08 12:36:44 +02:00
Brian Clozel df198987e0 Allow unlimited caching in ContentCachingRequestWrapper
Prior to this commit the `ContentCachingRequestWrapper(HttpServletRequest)`
constructor was deprecated; this variant caches by default an unlimited
amount of data. The replacement
`ContentCachingRequestWrapper(HttpServletRequest, int)` allows such
behavior in 7.0 but that change has not been bacported to 6.2.x.

This commit ensures that the replacement constructor can be safely used
in 6.2.x, preparing for the 7.0.x upgrade.

Fixes gh-36620
2026-04-08 11:29:27 +02:00
Sam Brannen b6a246989f Use ClassLoader for method or field in MergedAnnotation
Prior to this commit, the `return` keyword was missing in
TypeMappedAnnotation's getClassLoader() implementation, which prevented
the ClassLoader of the Member (Method or Field) from being used.

This commit fixes that by adding the missing `return` keyword and adds
a test using a custom ClassLoader to verify the correct behavior.

Closes gh-36606

(cherry picked from commit f3b6c222f9)
2026-04-07 18:24:04 +02:00
Brian Clozel 2a9afd6ede Document valid SpEL separators for tokenizer
(cherry picked from commit 14466eef4c)
(cherry picked from commit 8d390f4e5a)
2026-04-07 18:23:46 +02:00
Sam Brannen 9c82638820 Fix typo
(cherry picked from commit 9d365906b5)
2026-04-06 17:02:31 +02:00
Sam Brannen b2069e4c37 Fix flaky SpEL tests
This commit fixes SpEL related tests that failed if the test methods
were executed in a different order than in the Gradle build.

(cherry picked from commit 97e10a5948)
2026-04-06 17:02:14 +02:00
Sam Brannen 659271cf61 Fix BridgeMethodResolverTests.findBridgedMethodInHierarchy() in Eclipse
(cherry picked from commit bfbfe4a572)
2026-04-06 17:00:57 +02:00
Brian Clozel 39a6d4709f Deprecate types removed in 7.0
This commit `@Deprecate` for removal the following because support was
removed in 7.0:

* Netty 5 and Reactor Netty2 experimental support is abandonned
* Undertow does not support the Framework 7.0 baseline, developers
  should consider another Servlet container at this point

See gh-36591
2026-04-03 17:50:38 +02:00
Sam Brannen d78d80b02a Skip annotations that cannot be processed in AnnotationBeanNameGenerator
Prior to this commit, AnnotationBeanNameGenerator failed when searching
for a convention-based bean name, if an annotation referenced a
non-existent class.

To address that, this commit introduces a try-catch block around each
invocation of MergedAnnotation.asAnnotationAttributes() and skips
processing of the current MergedAnnotation if an exception occurs,
which is likely due to a type referenced from an annotation attribute
not being present in the classpath.

See gh-31203
Closes gh-36524

(cherry picked from commit 00fbd91cca)
2026-04-02 16:57:09 +02:00
Juergen Hoeller 684b1e8a4b Enforce strict implementation of Resource#isReadable() contract
Closes gh-36584

(cherry picked from commit e977bd7bf0)
2026-04-02 14:45:05 +02:00
Sam Brannen 6f204bf4a3 Polishing
(cherry picked from commit 24c7d31ba7)
2026-04-02 13:24:03 +02:00
Sam Brannen 5873e40782 Enforce use of AssertJ assumptions via Checkstyle
Closes gh-36582

(cherry picked from commit b6fc3a1b6f)
2026-04-02 13:24:03 +02:00
Sam Brannen 153e553675 Ignore .cursor directory
(cherry picked from commit d767806977)
2026-04-02 12:48:21 +02:00
Juergen Hoeller 9ceb9efb2c Polishing 2026-04-01 21:25:11 +02:00
Sam Brannen 9af3961b9b Deprecate methodIdentification() in CacheAspectSupport for removal
CacheAspectSupport currently contains a protected methodIdentification()
method which is not used internally within the framework, and it appears
that it was accidentally copied from TransactionAspectSupport when the
caching support was first introduced.

In light of that, this commit deprecates it for removal in 7.1.

See gh-36576
Closes gh-36576

(cherry picked from commit 22adccd190)
2026-03-31 17:51:17 +02:00
rstoyanchev fa04db3b03 Consistently log request details in ExchangeFunctions
Closes gh-36502
2026-03-31 16:26:37 +01:00
Sam Brannen 1a05ed236e Correct Javadoc for MergedAnnotation.asAnnotationAttributes()
Closes gh-36567

(cherry picked from commit b7a1157e66)
2026-03-30 17:03:14 +02:00
Sam Brannen 5a4a14c9c2 Polishing
(cherry picked from commit 27bc60e077)
2026-03-30 17:03:05 +02:00
Juergen Hoeller aff0ce1a00 Polishing 2026-03-28 20:53:26 +01:00
Juergen Hoeller cdfb77d5b0 Upgrade to Netty 4.1.132 and Protobuf 4.34.1 2026-03-28 11:47:13 +01:00
Juergen Hoeller 41f4072670 Fix ApplicationListenerMethodAdapter name in error message 2026-03-28 11:42:46 +01:00
Juergen Hoeller 49bb287800 Polishing
(cherry picked from commit b81a63fb5c)
2026-03-28 11:24:25 +01:00
Juergen Hoeller db6111fabe Add documentation notes on error handling with sync=true
See gh-36531

(cherry picked from commit 529a6fc932)
2026-03-28 11:23:59 +01:00
Sam Brannen 522a2e2e80 Introduce Kotlin examples for Bean Overrides (@⁠MockitoBean, etc.)
This commit introduces Kotlin examples in the reference manual for
@⁠MockitoBean, @⁠MockitoSpyBean, and @⁠TestBean.

Closes gh-36541

(cherry picked from commit 6d3d3d11c4)
2026-03-26 14:30:17 +01:00
Juergen Hoeller 0c2375a08c Consistent handling of early setCatalog/setSchema/setHoldability calls
Closes gh-36527
Closes gh-36528
2026-03-24 23:48:25 +01:00
Junseo Bae b7137c5baf Fix incorrect cross reference in AbstractEnvironment Javadoc
Closes gh-36516

Signed-off-by: Junseo Bae <ferrater1013@gmail.com>

(cherry picked from commit f92e810831)
2026-03-23 11:51:37 +01:00
Sam Brannen 315591f18e Sync changes to antora-playbook.yml from docs-build branch
(cherry picked from commit 9fba394b8a)
2026-03-23 11:37:25 +01:00
Juergen Hoeller 96a028a028 Consistent IOException spelling in class/method names 2026-03-21 12:19:07 +01:00
Juergen Hoeller 8b67472e35 Avoid endless re-interruption loop on shutdown
Closes gh-36506
2026-03-21 12:19:01 +01:00
Juergen Hoeller 3997551ba5 Recognize error code 149 as deadlock loser (MySQL Galera)
Closes gh-36499
2026-03-21 12:18:58 +01:00
Brian Clozel e607f1c30f Share codings resolution in resource resolvers
Prior to this commit, different resource resolvers would resolve
accepted codings from the HTTP request sent by the client. This would be
done with different implementations, which could lead to resolution
errors and desynchronizations.

This commit now introduced a new shared method in
`EncodedResourceResolver` (Servlet and Reactive) to perform a consisten
resolution.

Fixes gh-36507
2026-03-20 16:13:47 +01:00
Sam Brannen 506c6f1777 Clean up AssertJ usage after migration
- Avoid the use of assertThat(Arrays.equals(...))
- Convert assertThat(Boolean.FALSE).isEqualTo(x) to assertThat(x).isEqualTo(Boolean.FALSE)
- Convert assertThat(Boolean.TRUE).isEqualTo(x) to assertThat(x).isEqualTo(Boolean.TRUE)
- Convert assertThat(x.equals(y)).isTrue() to assertThat(x).isEqualTo(y)
- Convert assertThat(x.equals(y)).isFalse() to assertThat(x).isNotEqualTo(y)
- Remove unnecessary parentheses in assertThat() arguments
- Convert assertThat(x instanceof X).isFalse() to assertThat(x).isNotInstanceOf()
- Convert assertThat(x instanceof X).isTrue() to assertThat(x).isInstanceOf()
- Convert assertThat(!x).isTrue() to assertThat(x).isFalse()
- Inline conditions in assertThat() statements

Closes gh-36504

(cherry picked from commit e1e4d52b61)
2026-03-20 11:38:33 +01:00
Sam Brannen 6d6b788b25 Enable SpringJUnit5 Checkstyle rule
See gh-36496
Closes gh-36496

(cherry picked from commit 1256307c83)
2026-03-18 19:07:27 +01:00
Sam Brannen 01248c7753 Remove obsolete "test" prefix from test method names
Although this commit also changes the visibility of some test methods
to package-private, the remainder of that task will be addressed in
conjunction with gh-36496.

Closes gh-36495

(cherry picked from commit 4c14abf0cd)
2026-03-18 18:27:53 +01:00
github-actions[bot] 40562e2485 Update Antora Spring UI to v0.4.26 2026-03-17 09:21:37 +01:00
jun 52345c56a7 Fix typo in StompSession Javadoc
Closes gh-36469

Signed-off-by: jun <ryuu.public@gmail.com>
(cherry picked from commit c2c6130da5)
2026-03-16 13:40:12 +01:00
Sam Brannen e598df8c60 Fix common typos and grammatical mistakes
Closes gh-36471

(cherry picked from commit 5eb0e99d58)
2026-03-15 17:19:28 +01:00
Sam Brannen 0c4ed55fd2 Consistently use American English spelling
Since the Spring Framework uses American English spelling, this commit
updates Javadoc and the reference manual to ensure consistency in that
regard. However, there are two exceptions to this rule that arise due
to their use within a technical context.

- We use "cancelled/cancelling" instead of "canceled/canceling" in
  numerous places (including error messages).
- We use "implementor" instead of "implementer".

Closes gh-36470

(cherry picked from commit 17699103dc)
2026-03-15 17:16:39 +01:00
Sam Brannen 10faa7fdff Remove obsolete, custom Eclipse configuration for spring-oxm
See gh-36195

(cherry picked from commit 9b366b28b7)
2026-03-15 14:59:32 +01:00
Sam Brannen 2269c56d61 Polish contribution
See gh-36195

(cherry picked from commit 0f990e44a8)
2026-03-15 14:59:32 +01:00
Clayton Walker 15c82d558d Improve XJC configuration for spring-oxm in the Gradle build
Closes gh-36195

Signed-off-by: Clayton Walker <clayton.m.walker@gmail.com>

(cherry picked from commit e102bc4933)
2026-03-15 14:59:25 +01:00
Brian Clozel b4646ce9b4 Next development version (v6.2.18-SNAPSHOT) 2026-03-13 09:16:10 +01:00
Sébastien Deleuze 317a1f9909 Leverage ResourceHandlerUtils in ScriptTemplateView
This commit apply extra checks to ScriptTemplateView resource handling
with ResourceHandlerUtils, consistently with what is done with static
resource handling.

Closes gh-36459
2026-03-12 20:02:59 +01:00
Sébastien Deleuze de6601fdac Restore ScriptTemplateViewTests
Restore both WebMVC and WebFlux variants that were deleted
by mistake in commit 4db2f8ea1b.

This commit also removes the empty resource loader path, as it is not
needed for the main WEB-INF/ use case that is typically configured
explicitly by the user, and not needed to pass the restored tests.

Closes gh-36457
2026-03-12 19:53:26 +01:00
Sam Brannen 47dc1c4d93 Fix log message in ConfigurationClassBeanDefinitionReader
The log message now properly generates the fully-qualified method name
and includes the resolved bean name as well.

Closes gh-36453

(cherry picked from commit e634ced56b)
2026-03-12 16:25:03 +01:00
Juergen Hoeller d8c77934ff Upgrade to SnakeYAML 2.6, Protobuf 4.34, H2 2.4.240
(cherry picked from commit d8216d719b)
2026-03-11 15:55:42 +01:00
Juergen Hoeller 99fbce1254 Polishing (aligned with main) 2026-03-11 15:08:12 +01:00
Juergen Hoeller d1e69a9677 Upgrade to Reactor 2024.0.16 and Micrometer 1.15.10
Includes Jetty 12.0.33, Selenium 4.41, Mockito 5.22

Closes gh-36445
Closes gh-36446
2026-03-10 20:26:44 +01:00
Brian Clozel 8dc888e1b8 Guard against invalid id/event values in Server Sent Events
Prior to this commit, our implementation of Server Sent Events (SSE),
`SseEmitter` (MVC) and `ServerSentEvent` (WebFlux), would not guard
against invalid characters if the application mistakenly inserts such
characters in the `id` or `event` types.
Both implementations would also behave differently when it comes
to escaping comment multi-line events.

This commit ensures that both implementations handle multi-line comment
events and reject invalid characters in id/event types.
This commit also optimizes `String` concatenation and memory usage
when writing data.

Fixes gh-36440
2026-03-10 17:56:39 +01:00
Sam Brannen 131f94fbc5 Use link for first reference to @⁠Fallback in @⁠Bean Javadoc
See gh-36439

(cherry picked from commit 37e8aa76e9)
2026-03-10 17:54:05 +01:00
Sam Brannen d4f4c69318 Document @Fallback alongside Primary in the reference docs and @Bean Javadoc
Closes gh-36439

(cherry picked from commit 27686dc2e2)
2026-03-10 17:28:49 +01:00
Sam Brannen 74ab6625ac Document registration recommendations for BeanPostProcessor and BeanFactoryPostProcessor
Closes gh-34964

(cherry picked from commit 3b8efbe5a6)
2026-03-10 13:09:35 +01:00
Sam Brannen 7c27183a4f Polishing
(cherry picked from commit 6f2e59a995)
2026-03-10 13:09:26 +01:00
Sam Brannen 526f67cd83 Polish @⁠Bean Javadoc and reference docs
(cherry picked from commit 644a20ae2a)
2026-03-10 13:09:17 +01:00
Sam Brannen 88f081b1cd Resolve context initializers only once in AbstractTestContextBootstrapper
The internal buildMergedContextConfiguration() method in
AbstractTestContextBootstrapper originally resolved the
ApplicationContextInitializer set only once. However, the changes made
in commit 2244461778 introduced a regression resulting in the
initializers being resolved twice: once for validation and once for
actually building the merged context configuration. In addition, the
resolution for validation does not honor the inheritInitializers flag
in ContextConfigurationAttributes.

To address these issues, buildMergedContextConfiguration() once again
resolves the context initializers once via
ApplicationContextInitializerUtils.resolveInitializerClasses().

See gh-18528
Closes gh-36430

(cherry picked from commit 463138acbc)
2026-03-08 14:50:42 +01:00
Sam Brannen 5806a23bcf Address Checkstyle violation
(cherry picked from commit bbe733def7)
2026-03-05 11:44:13 +01:00
Sam Brannen 507399d9a8 Polish documentation for FrameworkServlet and HttpServletBean
(cherry picked from commit 50c29e64f8)
2026-03-05 11:25:11 +01:00
Juergen Hoeller cd9a430869 Polishing
(cherry picked from commit 4734c15d81)
2026-03-03 23:38:55 +01:00
Sam Brannen 0a933787a6 Exclude legacy @⁠javax.validation.Constraint from attribute override check
Prior to this commit, we only excluded @⁠jakarta.validation.Constraint
from the convention-based annotation attribute override check.

This commit additionally excludes the legacy
@⁠javax.validation.Constraint annotation from the convention-based
annotation attribute override check.

See gh-28760
See gh-28761
Closes gh-36412
2026-03-03 17:02:13 +01:00
cetf 2bbea84830 Fix format string argument count
Fixes: gh-36410
Signed-off-by: cetf <cetf9h@163.com>
2026-03-03 12:15:12 +01:00
dependabot[bot] b9517b8ed7 Upgrade fast-xml-parser to 5.3.8
Closes gh-36402

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

(cherry picked from commit a87b2e0146)
2026-03-01 13:14:49 +01:00
Sam Brannen f41786b6af Fix typo
(cherry picked from commit bd40f0e6bb)
2026-03-01 13:06:56 +01:00
Sam Brannen 2d10d513e1 Consistently refer to URLs and URIs in documentation
(cherry picked from commit 04186fdf0e)
2026-03-01 13:06:56 +01:00
Tran Ngoc Nhan c83fb69d9b Fix links to UriComponentsBuilder and polish examples
Closes gh-36403

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>

(cherry picked from commit b2b731b0ba)
2026-03-01 13:06:51 +01:00
Juergen Hoeller 566a42bec9 Remove prefixed FactoryBean name in ApplicationListenerDetector
Closes gh-36404

(cherry picked from commit a3b9098850)
2026-03-01 12:10:44 +01:00
Juergen Hoeller b426ef2d1b Polishing 2026-02-28 19:45:22 +01:00
Juergen Hoeller 728466dce0 Cancel late-executing tasks within revised closed handling
Closes gh-36362

(cherry picked from commit b6833ff31f)
2026-02-28 13:56:34 +01:00
Sam Brannen 455cb766a9 Further emphasize @⁠Configuration classes over XML and Groovy in testing chapter
See gh-36393

(cherry picked from commit 9eea227ab9)
2026-02-25 15:49:19 +01:00
Sam Brannen c77993acac Emphasize @⁠Configuration classes over XML and Groovy in testing chapter
Closes gh-36393

(cherry picked from commit 706c98228d)
2026-02-25 15:27:25 +01:00
Sam Brannen f3d0f9427a Upgrade to JUnit 5.14.3
Closes gh-36388
2026-02-25 11:00:24 +01:00
dependabot[bot] 688975e327 Upgrade fast-xml-parser to 5.3.6
Closes gh-36348

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit ee6a115a18)
2026-02-25 10:29:02 +01:00
Juergen Hoeller b619e69130 Polishing (aligned with main) 2026-02-24 18:04:40 +01:00
Juergen Hoeller 972ba739aa Reject late-executing tasks after termination waiting
Closes gh-36362

(cherry picked from commit cff48fff2d)
2026-02-24 17:58:18 +01:00
Sam Brannen f87b5ee326 Polish contribution
See gh-36367

(cherry picked from commit b1cb9c5052)
2026-02-23 17:33:15 +01:00
Tran Ngoc Nhan 7768cee7a0 Polish SpEL operator examples in reference docs
Closes gh-36367

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
(cherry picked from commit 057633edb5)
2026-02-23 17:33:07 +01:00
rstoyanchev 9042682b56 Optimal charset handling in AbstractHttpMessageConverter
Closes gh-36320
2026-02-23 15:44:26 +00:00
Brian Clozel 2d81a9fe9b Optimize MediaType(MediaType, Charset) constructor
Prior to this commit, the `MediaType` and `MimeType` "copy" constructors
would not leverage the fact that the existing instance has been
validated already (types, subtype and parameters have been checked
already for errors) and the entire validation would be performed again.
This would also allocate map instances in the process.

This commit ensures that the already validated information is reused
directly and that we avoid unnessecary operations and allocations for
such constructors.

Closes gh-36318
2026-02-23 15:40:18 +00:00
Brian Clozel a3f7179ab3 Fix InvalidMimeTypeException for compatible media types
The `AbstractMessageConverterMethodProcessor` is in charge of handling
controller method return values and to write those as HTTP response
messages. The content negotiation process is an important part.

The `MimeTypeUtils#sortBySpecificity` is in charge of sorting inbound
"Accept" media types by their specificity and reject them if the list
is too large, in order to protect the application from ddos attacks.

Prior to this commit, the content negotiation process would first get
the sorted "Accept" media types, the producible media types as
advertized by message converters - and collect the intersection of both
in a new list (also sorted by specificity). If the "Accept" list is
large enough (but under the limit), the list of compatible media types
could exceed that limit because duplicates could be introduced in that
list: several converters can produce the same content type.

This commit ensures that compatible media types are collected in a set
to avoid duplicates. Without that, exceeding the limit at this point
will throw an `InvalidMimeTypeException` that's not handled by the
processor and result in a server error.

Fixes gh-36300
2026-02-20 18:43:02 +01:00
rstoyanchev 50ef3b0a29 Update Javadoc of RestClient.Builder defaultStatusHandler
See gh-36248
2026-02-19 11:45:33 +00:00
Juergen Hoeller 1c7e79026f Skip serialization of potentially non-serializable cached state
Closes gh-36346

(cherry picked from commit 22bd8bd704)
2026-02-17 22:19:43 +01:00
Juergen Hoeller c8735efb9d Polishing (aligned with main) 2026-02-17 19:08:15 +01:00
Juergen Hoeller 999bbe3959 Polishing 2026-02-17 18:41:07 +01:00
Juergen Hoeller acab61f9a7 Consistent adaptation of HTTP headers on Servlet responses
Closes gh-36345
2026-02-17 18:40:50 +01:00
Juergen Hoeller bfa81290b3 Polishing 2026-02-17 12:18:31 +01:00
Juergen Hoeller 2c7ed5e5f1 Align validation groups check with InvocableHandlerMethod in spring-web
Closes gh-36337
2026-02-17 12:15:07 +01:00
Brian Clozel 474d520182 Fix MultipartParser & PartGenerator memory leak
Prior to this commit, the reactive `MultipartParser` and `PartGenerator`
types were leaking memory at runtime in specific cases:

* many HTTP clients must send multipart requests to be parsed and close
  the connection while uploading
* the `PartGenerator` must be configured to write file parts to
  temporary files on disk
* concurrency, upload speed must be important to trigger cases where the
  file system is not fast enough to consume incoming buffers

The `MultipartParser` parses and emits `BodyToken` to its sink
(here, the `PartGenerator`). By definition, Reactor's `FluxSink` when
created with `Flux.create(FluxSink)` will use a "buffer" strategy and
will queue emitted elements if they cannot be consumed.

Here, the cancellation signal does dispose internal states in the
`MultiPartParser` and `PartGenerator` but does not clear the internal
queue in `FluxSink`.

This commit ensures that an operation is registered to release buffers
on the discard event.

Fixes gh-36262
2026-02-13 18:45:05 +01:00
Juergen Hoeller 50bffe7ddc Detect all common size exceptions from Tomcat and Commons FileUpload 2.x
Closes gh-36317

(cherry picked from commit e8e24e65d2)
2026-02-13 16:32:56 +01:00
Brian Clozel 6d849bd9b0 Next development version (v6.2.17-SNAPSHOT) 2026-02-12 10:03:33 +01:00
Christian Schuster 8334388e20 avoid unnecessary locking in ConcurrentReferenceHashMap's implementation of computeIfAbsent and computeIfPresent
Signed-off-by: Christian Schuster <christian@dnup.de>

Closes gh-36308

(cherry picked from commit a9b1d6335e)
2026-02-11 18:08:59 +01:00
Brian Clozel 757b713f22 Use updated message in HttpEntityMethodProcessor
Prior to this commit, the `HttpEntityMethodProcessor` would create a new
`ServletServerHttpRequest` input message to parse the native Servlet
request, but would not reuse it for reading the request body using the
message converters.

In gh-32471, we applied a change that updates HTTP headers accordingly
when request parameters are read. But not reusing the input message
means that we are losing this update when instantiating the resulting
`HttpEntity`.

This commit ensures that `HttpEntityMethodProcessor` uses the input
message it just created when decoding the request body.

Fixes gh-36298
2026-02-11 14:07:21 +01:00
rstoyanchev a065563484 Optimize RequestMappingInfo hashcode calculation
Precalculated hashcode makes sense for infos in the registry, but
matched infos created on the fly don't need it.

Closes gh-36279
2026-02-11 09:42:01 +00:00
rstoyanchev 6162d89042 Cache HandlerMethod with resolved bean if singleton
See gh-36278
2026-02-11 09:12:08 +00:00
rstoyanchev 5c537db2cc Optimize single PathPattern match
Closes gh-36275
2026-02-11 09:10:54 +00:00
rstoyanchev 849553dc8e Avoid determineValidationGroups not necessary
There is no need to call determineValidationGroups if the method
itself doesn't require method validation.

See gh-36274
2026-02-11 09:05:19 +00:00
Brian Clozel 7240a5a669 Upgrade to Reactor 2024.0.15
Fixes gh-36289
2026-02-10 13:54:51 +01:00
Brian Clozel b00c387775 Upgrade to Micrometer 1.15.9
Closes gh-36290
2026-02-10 13:38:39 +01:00
Brian Clozel 8396c071af Fix wildcard MIME type support in messaging converters
Prior to this commit, the "application/*+json" wildcard MIME type was
added to the list of supported MIME types in the JSON messaging
converter. This change wasn't fully reflected in the
`AbstractMessageConverter`, because only strict matching of type and
subtybe were considered.

This commit updates the `AbstractMessageConverter` to not only check the
type and subtype, but also check whether the supported MIME type
includes the one given as a parameter.

Fixes gh-36285
2026-02-10 10:42:51 +01:00
Juergen Hoeller bb35e9f11c Make LocalEntityManagerFactoryBean#setDataSource work on Hibernate and EclipseLink
Includes fix for consistent PersistenceException in case of no unit found for name.
Includes proper tests for LocalContainerEntityManagerFactoryBean with scan setup.

Closes gh-36272
2026-02-08 18:06:58 +01:00
Juergen Hoeller a0319b1f91 Repeatedly check status while trying to lock for shutdown
Closes gh-36260

(cherry picked from commit 20970a4a37)
2026-02-06 19:04:55 +01:00
Juergen Hoeller 5973a17253 Polishing
(cherry picked from commit 153c378bb2)
2026-02-05 20:30:36 +01:00
Juergen Hoeller ed7243259b Upgrade to Groovy 4.0.30, Netty 4.1.130, Mockito 5.21 2026-02-02 12:58:03 +01:00
Juergen Hoeller a391db2ef5 Upgrade to ASM 9.9.1 and Objenesis 3.5
Closes gh-36244

(cherry picked from commit 40350653e1)
2026-02-02 12:42:53 +01:00
dependabot[bot] 957202523c Upgrade fast-xml-parser from 4.5.2 to 5.3.4 in /framework-docs
Closes gh-36234

(cherry picked from commit 6fd84e4c2f)
2026-01-31 15:33:14 +01:00
qwding a3c9166da7 Optimize NamedParameterUtils#buildValueArray by lazily fetching SqlParameter
This PR optimizes the performance of NamedParameterUtils#buildValueArray by deferring the call to findParameter(declaredParams, paramName, i).

Changes: In the original implementation, findParameter was called for every parameter in the loop, regardless of whether the paramValue retrieved from paramSource was already an instance of SqlParameterValue.

Since findParameter involves iterating through the declaredParams list (or performing lookups), skipping this call when paramValue instanceof SqlParameterValue is true reduces unnecessary CPU cycles and memory access, especially for queries with a large number of parameters or long declaredParams lists.

Signed-off-by: qwding <761945125@qq.com>
(cherry picked from commit 149397ed10)
2026-01-30 14:10:46 +01:00
Brian Clozel 0c3dd8cb00 Fix "remove" implementation in netty headers adapter
Prior to this commit, the `Netty4HeadersAdapter` `MultiValueMapi#remove`
implementation would return an empty list if no value was present. This
is not consistent with other implementations.

This change ensures that `null` is returned for those cases.

Fixes gh-36226
2026-01-29 11:31:50 +01:00
Juergen Hoeller 56d8ec25e8 Consistently close streams through try-with-resources
Also aligns byte array and Reader copying with 7.0.4.

Closes gh-36223

(cherry picked from commit 16f4b23c32)
2026-01-28 18:17:20 +01:00
Sam Brannen fb9db146f2 Consistently refer to "an SQL" statement, type, etc.
(cherry picked from commit 799a520c35)
2026-01-28 18:11:11 +01:00
Juergen Hoeller dcf98bc55c Polishing
(cherry picked from commit 5d33de943b)
2026-01-28 17:19:22 +01:00
Juergen Hoeller b9cd06a487 Support -1 for undetermined length in SqlBinaryValue/SqlCharacterValue
Closes gh-36219

(cherry picked from commit 7da65fe4fc)
2026-01-28 17:18:17 +01:00
Sam Brannen 91ff706e8c Fix formatting and spelling
(cherry picked from commit 4dacc64a30)
2026-01-28 14:31:44 +01:00
Sam Brannen 103057de2a Fix links to JUnit User Guide
Closes gh-36217

(cherry picked from commit ba47dd0714)
2026-01-28 14:31:34 +01:00
rstoyanchev b6d1e88563 Fix unfinished edit from previous commit
See gh-36198
2026-01-28 12:27:30 +00:00
rstoyanchev af1e9da3d7 Update docs on trailing slash handling
Closes gh-36198
2026-01-28 12:23:47 +00:00
rstoyanchev bc5e395a42 Update docs content types for ProblemDetail
Closes gh-36192
2026-01-28 12:21:56 +00:00
Juergen Hoeller 1ec3cb4d5f Polishing (aligned with main) 2026-01-27 21:25:23 +01:00
rstoyanchev 7b7126ae3d Polishing in ReactorClientHttpConnector 2026-01-26 10:46:59 +00:00
rstoyanchev 9f1332c716 Refine solution to clear Netty channel attribute
Closes gh-36158
2026-01-26 10:45:33 +00:00
Sam Brannen 2ff93f4207 Consistently indent with tabs instead of spaces 2026-01-25 17:57:36 +01:00
Sam Brannen 3a6c7786a1 Upgrade to AssertJ 3.27.7
(cherry picked from commit 801035bea7)
2026-01-25 17:57:36 +01:00
Padraic Slattery 539a098f8c Update GitHub upload-artifact action to version 6
Closes gh-36199

Signed-off-by: Padraic Slattery <pgoslatara@gmail.com>

(cherry picked from commit 65bdc78a1e)
2026-01-25 17:57:28 +01:00
Juergen Hoeller ecfd78ff93 Polishing (aligned with main) 2026-01-25 10:52:37 +01:00
Juergen Hoeller 1e0a85368e Revise setPersistenceUnitName javadoc
Closes gh-36205

(cherry picked from commit 22cf7958a5)
2026-01-25 10:47:56 +01:00
rstoyanchev c49d5dc860 Handle early exception from AsynchronousFileChannel#write
Closes gh-36184
2026-01-22 14:17:52 +00:00
Juergen Hoeller 58af70f2e3 Upgrade to Selenium 4.40, HtmlUnit 4.21, Protobuf 4.33.4 2026-01-21 14:59:57 +01:00
Juergen Hoeller c6e73b5d1d Fix JMSReplyTo references in javadoc (backported from main) 2026-01-21 14:52:16 +01:00
Juergen Hoeller f531cc9fdf Polishing
(cherry picked from commit 1c56ec3f7e)
2026-01-20 19:34:17 +01:00
Juergen Hoeller 1977f31821 Prevent accidental printStackTrace() usage in main codebase
Closes gh-36185

(cherry picked from commit 65565de1a8)
2026-01-20 19:33:30 +01:00
Sam Brannen cf3ed229de Fix test parameterization in CaffeineReactiveCachingTests
Prior to this commit, test methods in CaffeineReactiveCachingTests
were parameterized twice with the same configuration class.

See gh-31637
See gh-35833

(cherry picked from commit 9ebfdb8b6a)
2026-01-20 11:44:06 +01:00
Sam Brannen 154dad6587 Revise contribution
See gh-36170

(cherry picked from commit b164db35c1)
2026-01-18 17:02:09 +01:00
Tran Ngoc Nhan fd8b4d5936 Replace getErrors() with getBindingResult() in examples
DataBinder#getErrors was removed in v4.0.0.M1.

Closes gh-36170

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>

(cherry picked from commit 385e62dbf0)
2026-01-18 17:02:01 +01:00
Juergen Hoeller 13defc09f9 Fix setBody call in reactorNettyAttributes test
See gh-36158
2026-01-17 00:05:15 +01:00
Juergen Hoeller 9e512315ab Avoid javadoc build failure against HttpClient 5.5.x 2026-01-16 23:38:32 +01:00
Juergen Hoeller c750efb0a6 Bring back WebLogicJtaTransactionManager for WebLogic 15.1.1
Closes gh-36152
2026-01-16 23:19:48 +01:00
Juergen Hoeller 0033edad45 Apply transactionIsolationLock in EclipseLinkConnectionHandle as well
Closes gh-36165

(cherry picked from commit 2b96a61063)
2026-01-16 23:15:56 +01:00
rstoyanchev 183cd4c8cd Clear Netty channel attribute
Closes gh-36158
2026-01-16 17:22:11 +00:00
Juergen Hoeller 6bd0ed8e79 Polishing
(cherry picked from commit 62fd09dfa5)
2026-01-14 22:13:07 +01:00
rstoyanchev dcb7922a24 Exclude DataAccessException and MessagingException in DisconnectedClientHelper
Closes gh-36135
2026-01-14 11:55:51 +00:00
Yanming Zhou 05a9cc26ae Improve DisconnectedClientHelper to better guard ClassNotFoundException
Before this commit, WebClientException is ignored if RestClientException is not present.

Closes gh-36150

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2026-01-14 11:55:51 +00:00
Sam Brannen 05beb4ad4d Upgrade to JUnit 5.14.2
Closes gh-36148
2026-01-14 12:39:33 +01:00
rstoyanchev 5236b35687 Update Principal check in TransportHandlingSockJsService
Closes gh-35753
2026-01-12 15:21:59 +00:00
Sébastien Deleuze 7482ccc18f Upgrade Antora dependencies
Closes gh-36106
2026-01-07 09:57:09 +01:00
Sam Brannen b3fb9f4e31 Reliably resolve generic read/write methods in PropertyDescriptorUtils
Prior to this commit, the determineBasicProperties() method in
PropertyDescriptorUtils did not reliably resolve read/write methods in
type hierarchies with generics. This utility method is used by
SimpleBeanInfoFactory which is used by BeanUtils and BeanWrapperImpl.
Thus, failure to reliably resolve read/write JavaBeans methods resulted
in bugs in certain scenarios.

For example, BeanUtils.copyProperties() randomly failed to copy certain
properties if the write method for the property could not be resolved.

To address such issues, this commit revises the implementation of
PropertyDescriptorUtils as follows.

1) Read methods with covariant return types are now consistently
   resolved correctly.

2) If multiple ambiguous write methods are discovered, the algorithm now
   checks for an exact match against the resolved generic parameter type
   as a fallback.

Closes gh-36019

(cherry picked from commit 4b07edbaeb)
2025-12-29 12:41:46 +02:00
Sam Brannen add3b1a7f4 Extract CopyPropertiesTests as nested test class in BeanUtilsTests 2025-12-29 12:38:01 +02:00
Sam Brannen 476aae5ce8 Polish integration tests 2025-12-29 12:32:42 +02:00
Brian Clozel be68a777b6 Fix memory leak in WiretapConnector
Prior to this commit, we found in gh-35953 that using the `WebTestClient`
the following way leaks data buffers:

```
var body = client.get().uri("download")
  .exchange()
  .expectStatus().isOk()
  .returnResult()
  .getResponseBodyContent();
```

Here, the test performs expectations on the response status and headers,
but not on the response body. The WiretapConnector already supports this
case by subscribing to the Flux response body in those cases and
accumulating the entire content as a single byte[].

Here, the `DataBuffer` instances are not decoded by any `Decoder` and
are not released. This results in a memory leak.

This commit ensures that the automatic subscription in
`WiretapConnector` also releases the buffers automatically as the DSL
does not allow at that point to go back to performing body expectations.

Fixes gh-36050
2025-12-19 16:20:10 +01:00
Juergen Hoeller 9a0bfd7306 Do not attempt nested PropertyHandler resolution for argument conversion
This is not actually triggered on 6.2.x but nevertheless worth aligning.
Includes fix for return type declaration in PropertyAccessor subclasses.
Includes related polishing from main commits.

See gh-36024
2025-12-17 14:56:12 +01:00
Brian Clozel 91a0c28fa9 Fix RfcUriParser parsing for single char fragments
Prior to this commit, the `RfcUriParser` would ignore URI fragments if
their length is < 2. This commit fixes the length check to allow for
single char fragments when parsing URIs.

Fixes gh-36029
2025-12-17 09:54:08 +01:00
Sam Brannen c0e8a36592 Polishing
(cherry picked from commit ed451c107f)
2025-12-13 17:17:46 +01:00
Sam Brannen 836289315d Revise contribution
See gh-36022

(cherry picked from commit 452257eb96)
2025-12-13 17:16:49 +01:00
Tran Ngoc Nhan 08b77dd0ad Fix typos and grammar in reference manual
Closes gh-36022

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>

(cherry picked from commit a7863a0877)
2025-12-13 17:16:04 +01:00
Stéphane Nicoll 5eb16a6a17 Refresh GitHub Actions 2025-12-12 11:58:22 +01:00
Brian Clozel d4705804cc Next development version (v6.2.16-SNAPSHOT) 2025-12-11 11:34:10 +01:00
Brian Clozel 23625ee698 Do not send null HTTP header value in JdkClientHttpRequest
Prior to this commit, the `JdkClientHttpRequest` would add all values
from `HttpHeaders` to the native request builder. This could cause
`NullPointerException` being thrown at runtime because the `HttpClient`
does not support that.

This commit replicates a fix that was applied to the
`SimpleClientHttpRequest`, turning null values into empty "".

Fixes gh-35996
2025-12-11 09:57:55 +01:00
Brian Clozel c89c4ac614 Upgrade to Reactor 2024.0.13
Closes gh-35987
2025-12-09 22:26:46 +01:00
Brian Clozel 2155e9fb25 Upgrade to Micrometer 1.14.14
Closes gh-35986
2025-12-09 22:26:10 +01:00
Juergen Hoeller 24df35c55a Do not keep target connection after failed settings
Includes aligned setReadOnly exception suppression.

Closes gh-35980

(cherry picked from commit ab33000750)
2025-12-09 13:01:36 +01:00
Brian Clozel 3b1fa369b4 Polishing contribution
Closes gh-35978
2025-12-08 16:11:38 +01:00
Johnny Lim 221adf14a4 Fix SubscriberInputStream.resume()
See gh-35978

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-12-08 16:11:31 +01:00
Juergen Hoeller ad849fb3a2 Accept assignable match for covariant return type
See gh-35936

(cherry picked from commit df27627516)
2025-12-08 12:43:35 +01:00
Juergen Hoeller 8041a09268 Polishing 2025-12-05 16:23:12 +01:00
Juergen Hoeller 97b9517918 Handle absolute file URLs in getClassPathManifestEntriesFromJar
Closes gh-35682

(cherry picked from commit 196c1dd51c)
2025-12-05 16:16:44 +01:00
Sam Brannen e79d8e35a2 Document that annotations which reference types not present are ignored
Add warnings to the class-level Javadoc for MergedAnnotations,
AnnotatedTypeMetadata, AnnotationMetadata, and MethodMetadata to point
out that annotations may be ignored if their attributes reference types
that are not present in the classpath.

Closes gh-35959

(cherry picked from commit b916dc962e)
2025-12-05 16:02:14 +01:00
rstoyanchev 96503a2ea6 Polishing 2025-12-04 09:31:20 +00:00
rstoyanchev 8803d3c5dc Lower bad requests to DEBUG level in AbstractHandshakeHandler
Closes gh-35930
2025-12-04 09:24:11 +00:00
rstoyanchev 5b4728f0bf Avoid http - web.utils package cycle
Closes gh-35952
2025-12-04 09:23:45 +00:00
Juergen Hoeller 1fd1d8d629 Polishing
(cherry picked from commit 07c0213f20)
2025-12-04 00:40:02 +01:00
Juergen Hoeller afc40d7b93 Avoid computeIfAbsent for createMappings which calls back into same map
Closes gh-35944

(cherry picked from commit 667851c0fa)
2025-12-04 00:15:36 +01:00
Sam Brannen 3eb1df0ac0 Update antora-extensions to 1.14.7
Closes gh-35949

(cherry picked from commit c7e24a5c26)
2025-12-02 15:36:45 +01:00
Juergen Hoeller 2aa3b0a77e Select method with resolved return type match (among multiple candidates)
Removes unnecessary array type check for parameters of candidate methods.

Closes gh-35936

(cherry picked from commit 92e9543ad4)
2025-12-01 23:28:09 +01:00
ivonaest 0008106adb Upgrade json-path to 2.10.0
Closes gh-35924
Signed-off-by: ivonaest <ivona.cvija@est.tech>
2025-12-01 15:36:44 +01:00
Juergen Hoeller 8f6d44a86b Improve debug log for received message
(cherry picked from commit 71d18ebabc)
2025-12-01 15:04:42 +01:00
Juergen Hoeller 874498272f Clear remaining invoker resources when releasing shared Connection
Closes gh-35932

(cherry picked from commit 3ccb0786db)
2025-12-01 15:04:39 +01:00
rstoyanchev 2144813bad FragmentsRendering exposes its fragments
Closes gh-35775
2025-12-01 11:20:43 +00:00
John Niang 67a92306f7 BindingContext constructor uses given ReactiveAdapterRegistry arg
Closes gh-35771

Signed-off-by: John Niang <johnniang@foxmail.com>
2025-12-01 11:20:29 +00:00
rstoyanchev bc0731891b Use channelId for ReactorNettyWebSocketSession's id
Closes gh-35883
2025-12-01 11:20:13 +00:00
Juergen Hoeller 3faa7cac4d Polishing 2025-11-30 11:41:24 +01:00
Sam Brannen 3121daf553 Stop linking to 6.1.22-SNAPSHOT reference docs
With this commit, we now include snapshots for main (which currently
correlates to 7.0.x), 6.2.x, and 7.0.x to 9.*.x.

Closes gh-35923

(cherry picked from commit 305a512a55)
2025-11-28 14:06:48 +01:00
Juergen Hoeller 821165488e Use concurrent set for reactive transaction synchronizations
Closes gh-35921

(cherry picked from commit fd25e2f468)
2025-11-28 10:25:54 +01:00
Juergen Hoeller 3b556ba0c0 Polishing 2025-11-27 16:10:56 +01:00
Juergen Hoeller b25f98374b Tighten cacheable decision behind @Lazy injection point
Closes gh-35917

(cherry picked from commit 61d5413c23)
2025-11-27 16:03:27 +01:00
Sam Brannen c2f7cd3401 Convert sentence to tip in Kotlin testing chapter
This commit also moves the text to a more appropriate section of the
chapter.

(cherry picked from commit 24d152cdab)
2025-11-27 12:38:55 +01:00
Juergen Hoeller 22d2810ed0 Narrow method annotation check in hasQualifier to setter methods
Closes gh-35908

(cherry picked from commit 6c3132cb8c)
2025-11-26 23:02:58 +01:00
Tran Ngoc Nhan b39055f293 Fix broken Javadoc links to methods
Closes gh-35904
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-11-26 17:12:18 +01:00
Sam Brannen 140933400d Refer to "Spring Tools" instead of "Spring Tools for Eclipse"
Closes gh-35901

(cherry picked from commit 6504177e7b)
2025-11-26 16:12:27 +01:00
Juergen Hoeller e7a5452a14 Consistent namespace element declarations
(cherry picked from commit f58d0f6aae)
2025-11-26 15:14:31 +01:00
Juergen Hoeller ab96576e67 Expose non-existent resources at the end of the sorted result
Closes gh-35895

(cherry picked from commit c1b6bfb681)
2025-11-26 15:14:28 +01:00
Juergen Hoeller 19b080b73f Clarify JMS sessionTransacted flag for local versus global transaction
Closes gh-35897

(cherry picked from commit 9d4abb63d8)
2025-11-26 15:14:24 +01:00
rstoyanchev f9b4fba97a Add required type to TypeMismatchException message args
Closes gh-35837
2025-11-26 12:50:26 +00:00
Sam Brannen 37e26e0377 Use current links to JUnit documentation
Closes gh-35892

(cherry picked from commit f4ee120a42)
2025-11-26 13:25:54 +01:00
Sam Brannen 85c47a73dd Fix formatting for backticks in Kotlin docs
(cherry picked from commit e625a28f6d)
2025-11-26 13:24:27 +01:00
Sam Brannen ab93020263 Link to Spring Framework Artifacts wiki page
This commit revises the Integration Testing chapter to reference the
"Spring Framework Artifacts" wiki page instead of the nonexistent
"Dependency Management" section of the reference manual.

Closes gh-35890

(cherry picked from commit 45c1cd9295)
2025-11-26 12:55:46 +01:00
github-actions[bot] a4134663a6 Update Antora Spring UI to v0.4.25
Closes gh-35877

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-24 14:44:14 +01:00
github-actions[bot] a4b1155ca6 Update Antora Spring UI to v0.4.22
Closes gh-35859
2025-11-24 10:14:50 +01:00
Sébastien Deleuze 1bdd8337c6 Update outdated comments in JdbcOperationsExtensions.kt 2025-11-20 09:55:10 +01:00
Brian Clozel 7a0ea14452 Next development version (v6.2.15-SNAPSHOT) 2025-11-20 09:48:06 +01:00
Juergen Hoeller 59025c5b96 Lazily initialize ProblemDetail for picking up actual status code
Closes gh-35829

(cherry picked from commit 3026f0a49b)
2025-11-19 17:31:27 +01:00
Sam Brannen e5de8b9bc6 Fix link to MockMvc test in HtmlUnit section
See gh-35853

(cherry picked from commit 9fe4e7798d)
2025-11-19 17:19:34 +01:00
Sam Brannen e146e809e5 Polishing
(cherry picked from commit d178930186)
2025-11-19 17:19:34 +01:00
Tran Ngoc Nhan ff62e7355f Fix cross-reference links in HtmlUnit sections
Closes gh-35853

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>

(cherry picked from commit 91d2a51f3f)
2025-11-19 17:19:30 +01:00
Juergen Hoeller 4e97013595 Polishing
(cherry picked from commit f456674529)
2025-11-19 16:21:38 +01:00
Juergen Hoeller bd10b7ae06 Remove javadoc references to deprecated PropertiesBeanDefinitionReader
Closes gh-35836

(cherry picked from commit 35b8fbf901)
2025-11-19 16:21:33 +01:00
Juergen Hoeller e4288170c8 Fix getCacheNames() concurrent access in NoOpCacheManager
Closes gh-35842

(cherry picked from commit 57a1d4007b)
2025-11-18 13:50:13 +01:00
Juergen Hoeller 8545a759a7 Add resetCaches() method to Caffeine/ConcurrentMapCacheManager
Closes gh-35840

(cherry picked from commit bc3431f435)
2025-11-18 13:49:20 +01:00
Juergen Hoeller f94645de17 Narrow Aware interface exclusion check to BeanFactoryAware only
Closes gh-35835

(cherry picked from commit de5b9aab55)
2025-11-18 13:48:32 +01:00
Sam Brannen 8553f97df1 Merge HtmlCharacterEntityDecoderTests into HtmlUtilsTests
See gh-35711

(cherry picked from commit 0342cd0904)
2025-11-17 15:29:52 +01:00
Brian Clozel 030dace2be Polishing contribution
Closes gh-35477
2025-11-17 15:15:39 +01:00
potato 5af1c9b487 Fix HtmlUtils unescape for supplementary chars
See gh-35477

Signed-off-by: potato <65760583+juntae6942@users.noreply.github.com>
2025-11-17 15:15:39 +01:00
Patrick Strawderman f3ed04c9d7 Fix single-check idiom in UnmodifiableMultiValueMap
Read the respective fields only once in the values(), entrySet(), and
keySet() methods.

Closes gh-35822

Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>

(cherry picked from commit 3b6be3d4d3)
2025-11-17 15:04:49 +01:00
github-actions[bot] 46ee944acc Update Antora Spring UI to v0.4.20
Closes gh-35814
2025-11-17 14:22:35 +01:00
Sam Brannen 6be1c29fda Polish contribution
See gh-35817

(cherry picked from commit 09a8bbc0c7)
2025-11-17 12:28:03 +01:00
Patrick Strawderman 3fa56db88b Fix Spliterator characteristics in ConcurrentReferenceHashMap
The Spliterators returned by values, entrySet, and keySet incorrectly
reported the SIZED characteristic, instead of CONCURRENT. This could
lead to bugs when the map is concurrently modified during a stream
operation.

For keySet and values, the incorrect characteristics are inherited from
AbstractMap, so to rectify that the respective methods are overridden,
and custom collections are provided that report the correct Spliterator
characteristics.

Closes gh-35817

Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>

(cherry picked from commit ed75906834)
2025-11-17 12:27:43 +01:00
Brian Clozel ed444eb0c1 Next development version (v6.2.14-SNAPSHOT) 2025-11-13 10:11:35 +01:00
Brian Clozel da31750e5f Upgrade to Micrometer 1.14.13
Closes gh-35810
2025-11-13 09:15:09 +01:00
Brian Clozel b853203846 Upgrade to Reactor 2024.0.12
Closes gh-35809
2025-11-13 09:14:04 +01:00
Brian Clozel 2b04df045a Upgrade to Jetty 12.0.30
Closes gh-35806
2025-11-12 21:57:31 +01:00
Juergen Hoeller 40544e096f Fix typo in ProxyMethodInvocation javadoc 2025-11-11 19:42:02 +01:00
Juergen Hoeller 23354b0155 Fix doTask method visibility (referring to private Task type)
See gh-35794
2025-11-11 19:41:44 +01:00
Juergen Hoeller 5c5367a1be Polishing 2025-11-11 15:40:08 +01:00
Juergen Hoeller 12dd758158 Provide compute method implementations in ConcurrentReferenceHashMap
Closes gh-35794
2025-11-11 15:39:21 +01:00
Sébastien Deleuze 5aec239261 Add hints for entities package-private methods
Closes gh-35711
2025-11-11 13:52:59 +01:00
Dmitry Sulman d0ff8f9243 Fix HttpServiceMethod for suspending functions returning Flow
Closes gh-35718
Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
2025-11-11 12:58:42 +01:00
Brian Clozel ba39385cce Use executor for blocking I/O in Reactor request factory
Prior to this commit, the `ReactorClientHttpRequestFactory` and the
`ReactorClientHttpRequest` would use the `Executor` from the current
event loop for performing write operations.
Depending on I/O demand, this work could be blocked and would result in
blocked Netty event loop executors and the HTTP client hanging.

This commit ensures that the client uses a separate Executor for such
operations. If the application does not provide one on the request
factory, a `Schedulers#boundedElastic` instance will be used.

Fixes gh-34707
2025-11-10 16:12:14 +01:00
rstoyanchev e735c2d9c5 Improve Filter overview in reference docs
Closes gh-30454
2025-11-10 14:43:34 +00:00
rstoyanchev 3cb498fa98 Improve docs on streaming via StreamingHttpOutputMessage
Closes gh-35700
2025-11-10 14:43:34 +00:00
Sam Brannen 335a2c4e21 Support response encoding in select and options JSP form tags
Prior to this commit, Spring Framework's JSP form tags supported the
response encoding in most places; however, <form:select> and
<form:options> still did not support the response character encoding.

To address that, this commit updates SelectTag, OptionsTag, and
OptionWriter to provide support for response character encoding in the
`select` and `options` JSP form tags.

See gh-33023
Closes gh-35783
2025-11-10 15:35:13 +01:00
Sam Brannen 1714a00492 Suppress warnings in Gradle build 2025-11-10 14:13:34 +01:00
Chandra Bhan Singh ddb45a9302 Correct documentation formatting for Mono type
Closes gh-35786
Signed-off-by: Chandra Bhan Singh <cbhansingh1@gmail.com>
2025-11-10 12:03:37 +01:00
Juergen Hoeller 38555df3d8 Fix Aware exclusion check to apply to interface method only
See gh-35780
2025-11-08 09:53:17 +01:00
Juergen Hoeller 6f81cb625c Avoid unnecessary bridge method resolution around getMostSpecificMethod
Closes gh-35780
2025-11-08 09:16:31 +01:00
Juergen Hoeller 566078b4e4 Add explicit note on empty constructor
See gh-35773
2025-11-08 09:14:53 +01:00
Brian Clozel f0cf7f19f6 Fix multi-release JAR issue with VirtualThreadDelegate
This commit ensures that both `VirtualThreadDelegate` implementations
expose the same public API. If not, JAR verification fails with the
following message:

```
jar --validate --file spring-core-6.2.13-SNAPSHOT.jar
entry: META-INF/versions/21/org/springframework/core/task/VirtualThreadDelegate.class, contains a class with different api from earlier version
```

Fixes gh-35773
2025-11-07 14:01:51 +01:00
Juergen Hoeller b5008d33ee Upgrade to ASM 9.9 plus lenient version check patch
Closes gh-35763
2025-11-06 10:41:34 +01:00
Juergen Hoeller bce1445d92 Accept fallback match for bean name or method-level qualifier as well
Closes gh-35690
2025-11-05 19:31:53 +01:00
Brian Clozel 285182be27 Relax multiple segment matching constraints in PathPattern
Prior to this commit, gh-35213 allowed wildcard path elments at the
start of path patterns. This came with an additional constraint that
rejected such patterns if the pattern segment following the wildcard one
was not a literal:

* `/**/{name}` was rejected
* `/**/something/{name}` was accepted

The motivation here was to make the performance impact of wildard
patterns as small as possible at runtime.

This commit relaxes this constraint because `/**/*.js` patterns are very
popular in the security space for request matchers.

Closes gh-35686
2025-11-05 18:32:44 +01:00
Brian Clozel 8bb63081a8 Document PathPattern matching for single/multiple segments
This commit improves the reference document to better reflect the
different between `*` or `{name}` on one side, and `**` or `{*path}` on
the other.

The former patterns only consider a single path segment and its content,
while the latter variants consider zero or more path segments. This
explains why `/test/{*path}` can match `/test`.

Closes gh-35727
2025-11-05 14:58:58 +01:00
rstoyanchev a698b1bc0d Refine validation section for controllers
Closes gh-35759
2025-11-05 12:23:43 +00:00
Juergen Hoeller 2060c340ce Upgrade to Caffeine 3.2.3, Selenium 4.38, HtmlUnit 4.18 2025-11-05 12:44:28 +01:00
Juergen Hoeller 4f97c41e58 Avoid javadoc failure for line break with annotation reference
See gh-35736
2025-11-05 12:35:09 +01:00
Juergen Hoeller 0243059f53 Polishing 2025-11-05 12:22:56 +01:00
Juergen Hoeller b027b73a7a Relax configuration class requirement in configurer callback javadoc
Closes gh-35736
2025-11-05 12:22:44 +01:00
Brian Clozel c0429dbb09 Fix file extension resolution for media types with q parameter
Prior to this commit, the `MappingMediaTypeFileExtensionResolver` would
resolve file extensions for a given media type by using a direct lookup
using the given media type provided by the request.
If the request contains a quality parameter like
"application/json;q=0.9", this would not resolve configured file
extensions for this media type.
While other media type parameters can be meaningful, the quality
parameter should not be used for lookups. This commit ensures that the
quality parameter is dropped before performing lookups.

Fixes gh-35754
2025-11-05 10:48:24 +01:00
Brian Clozel d65de19e7d Deprecate setConnectTimeout on HttpComponents client factory
Prior to this commit, the `HttpComponentsClientHttpRequestFactory` would
set the connection timeout on the request configuration. This has been
deprecated by the client itself and this value should be set while
creating the client on the connection manager itself.

This commit deprecates this method, as there is no way for the factory
to set this value anymore.

Closes gh-35748
2025-11-03 16:53:54 +01:00
Sébastien Deleuze 16822c2fd0 Polishing
Closes gh-35746
2025-11-03 11:14:30 +01:00
Moad Elfatihi 983d39a970 Update CI documentation reference in README
Replace obsolete Concourse pipeline reference with GitHub Actions.
The Concourse link returns 404.

See gh-35746
Signed-off-by: Moad ELFATIHI <elfatihi.moad@gmail.com>
2025-11-03 11:14:14 +01:00
Juergen Hoeller 4b7cf85d71 Retrieve cached response body in a thread-safe manner
Closes gh-35745
2025-11-02 20:40:02 +01:00
Juergen Hoeller a33027703d Preserve Connection readOnly state for defaultReadOnly DataSource
Includes DataSourceTransactionManagerTests alignment with main branch.

Closes gh-35743
2025-11-02 17:28:12 +01:00
Sam Brannen ae804cb2d0 Improve @⁠NumberFormat Javadoc
See gh-35742
2025-11-02 16:23:47 +01:00
Stefano Cordio 46503d6a45 Fix typo in @⁠NumberFormat Javadoc
Closes gh-35742

Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
2025-11-02 16:14:11 +01:00
Sam Brannen b4a13dddfc Fix JUnit Jupiter discovery issues on 6.2.x 2025-11-01 14:46:23 +01:00
Sam Brannen 661dca5e54 Remove accidental use of SpringExtension in ServletContextAwareBeanWacTests 2025-11-01 14:26:08 +01:00
Sam Brannen b976010a9e Simplify MockMvcClientHttpRequestFactoryTests 2025-11-01 14:26:07 +01:00
Juergen Hoeller 15563ee54e Polishing 2025-11-01 12:43:51 +01:00
Artur Signell 97586b525f fix: Fix PathMatchingResourcePatternResolver to handle absolute paths in JAR manifests
When JAR manifest Class-Path entries contain absolute paths (as Gradle
creates on Windows for long classpaths), PathMatchingResourcePatternResolver
incorrectly rejected them.

Fixes #35730

Signed-off-by: Artur Signell <artur@vaadin.com>
2025-11-01 12:25:20 +01:00
Sam Brannen f89737e398 Upgrade to JUnit 5.14.1
Closes gh-35739
2025-11-01 11:05:43 +01:00
Stéphane Nicoll ecdf069c5d Add AOT support for AutowiredPropertyMarker
Closes gh-35731
2025-10-31 15:30:54 +01:00
Anton Xu 01a58a253b Fix minor typo in RestClient
Closes gh-35723
Signed-off-by: Anton Xu <anton-xu@hotmail.com>
2025-10-30 19:41:56 +01:00
Juergen Hoeller f28e245baa Upgrade to Groovy 4.0.29, Jetty 12.0.29, Jackson 2.18.5 2025-10-30 17:30:21 +01:00
Park Juhyeong 14579b7848 Fix concurrency permit leak causing permanent deadlock in SimpleAsyncTaskExecutor
When concurrency limiting is enabled via setConcurrencyLimit() and
thread creation fails in doExecute() (e.g., OutOfMemoryError from
Thread.start()), the concurrency permit acquired by beforeAccess()
is never released because TaskTrackingRunnable.run() never executes.

This causes the concurrency count to permanently remain at the limit,
causing all subsequent task submissions to block forever in
ConcurrencyThrottleSupport.onLimitReached().

Root cause:
- beforeAccess() increments concurrencyCount
- doExecute() throws Error before thread starts
- TaskTrackingRunnable.run() never executes
- afterAccess() in finally block never called
- Concurrency permit permanently leaked

Solution:
Wrap doExecute() in try-catch block in the concurrency throttle path
and call afterAccess() in catch block to ensure permit is always
released, even when thread creation fails.

The fix only applies to the concurrency throttle path. The
activeThreads-only path does not need fixing because it never calls
beforeAccess(), so there is no permit to leak.

Test approach:
The test simulates thread creation failure and verifies that a
subsequent execution does not deadlock. The first execution should
fail with some exception (type doesn't matter), and the second
execution should complete within timeout if the permit was properly
released.

Signed-off-by: Park Juhyeong <wngud5957@naver.com>
2025-10-30 17:29:39 +01:00
Juergen Hoeller 5471961f06 Restore exposure of original BatchUpdateException as root cause
Closes gh-35717
See gh-35547
2025-10-30 14:59:00 +01:00
rstoyanchev 715bc68c16 Rename methods in FragmentsRendering
Previous commit 81ea35c726 in main for 7.0
should have been applied in 6.2.x first for 6.2.1.

This commit applies the changes in 6.2.x as intended,
effective as of 6.2.13.

Closes gh-33974
2025-10-30 12:17:51 +00:00
Sam Brannen 9c24f7ba8c Document test-method scoped TestContext semantics
Although gh-35680 introduced support for JUnit Jupiter's TEST_METHOD
ExtensionContextScope in the SpringExtension and
BeanOverrideTestExecutionListener, those were internal changes that are
not directly visible by TestExecutionListener authors.

However, in order to be compatible with a test-method scoped
TestContext (which takes its values from the current Jupiter
ExtensionContext), existing third-party TestExecutionListener
implementations may need to be modified similar to how
BeanOverrideTestExecutionListener was modified in commit d24a31d469.

To raise awareness of how to deal with such issues, this commit
documents test-method TestContext semantics for TestExecutionListener
authors.

Closes gh-35716
2025-10-30 11:22:25 +01:00
Juergen Hoeller a40647a62f Remove empty ConstraintValidator#initialize implementations 2025-10-28 20:38:08 +01:00
Juergen Hoeller b53fb13f30 Add tests for name-based dependency resolution against util:map
See gh-35690
2025-10-28 20:34:49 +01:00
Park Juhyeong 4b7b280ac3 Optimize resource URL resolution in SortedResourcesFactoryBean
Cache resource URLs before sorting to eliminate repeated I/O calls
during comparator operations. The previous implementation called
getURL() multiple times per resource during sorting (O(n log n)
calls), and silently swallowed IOExceptions by returning 0,
potentially causing unstable sort results.

This change:
- Caches URLs once per resource before sorting (O(n) I/O calls)
- Removes unnecessary ArrayList conversions
- Provides clear exception handling with context
- Improves performance by ~70% for typical use cases

Signed-off-by: Park Juhyeong <wngud5957@naver.com>
2025-10-28 20:30:33 +01:00
Sébastien Deleuze b3aefac9c3 Remove jibx-marshaller element from spring-oxm.xsd
Closes gh-35699
2025-10-28 15:38:53 +01:00
rstoyanchev b19059f6cb Handle null from JDK HttpResponse#body
Closes gh-35692
2025-10-28 11:44:16 +00:00
Sam Brannen b1f5b61bcd Abort search for static methods in getPubliclyAccessibleMethodIfPossible()
Prior to this commit, getPubliclyAccessibleMethodIfPossible() in
ClassUtils incorrectly returned a hidden static method as an
"equivalent" method for a static method with the same signature;
however, a static method cannot be overridden and therefore has no
"equivalent" method in a super type.

To fix that bug, this commit immediately aborts the search for an
"equivalent" publicly accessible method when the original method is a
static method.

See gh-33216
See gh-35189
See gh-35556
Closes gh-35667
2025-10-26 15:21:17 +01:00
rstoyanchev 810e069bcc FieldError uses HexFormat to format byte[]
See gh-35675
2025-10-24 13:01:28 +01:00
Elijah Mock 62f42cab6b Fix minor typo in JDBC Core Classes documentation
This commit adds a missing closing parenthesis in an example.

Closes gh-35684

Signed-off-by: Elijah Mock <28277163+ekcom@users.noreply.github.com>
2025-10-24 13:56:25 +02:00
Sam Brannen 9ee16b8ea3 Switch back to HSQL for JpaEntityListenerTests on main 2025-10-22 19:14:26 +02:00
Sam Brannen e61884e4bd Introduce tests for "No transaction in progress for @⁠Nested test class"
Since we now officially support the TEST_METHOD ExtensionContextScope
(see gh-35676 and gh-35680), this commit introduces tests which
demonstrate that the issue raised in gh-34576 is no longer an "issue" if
the user indirectly configures the SpringExtension to use the TEST_METHOD
scope via the "junit.jupiter.extensions.testinstantiation.extensioncontextscope.default"
configuration parameter.
2025-10-22 18:58:08 +02:00
Sam Brannen 0f2fc79fb7 Update exception message to use correct test class
See gh-35680
2025-10-22 18:04:13 +02:00
Sam Brannen ba70c1384a Polish SpringExtension internals 2025-10-22 17:07:53 +02:00
Sam Brannen d24a31d469 Support JUnit Jupiter ExtensionContextScope.TEST_METHOD
Historically, @⁠Autowired fields in an enclosing class of a @⁠Nested
test class have been injected from the ApplicationContext for the
enclosing class. If the enclosing test class and @⁠Nested test class
share the same ApplicationContext configuration, things work as
developers expect. However, if the enclosing class and @⁠Nested test
class have different ApplicationContexts, that can lead to
difficult-to-debug scenarios. For example, a bean injected into the
enclosing test class will not participate in a test-managed transaction
in the @⁠Nested test class (see gh-34576).

JUnit Jupiter 5.12 introduced a new ExtensionContextScope feature which
allows the SpringExtension to behave the same for @⁠Autowired fields as
it already does for @⁠Autowired arguments in lifecycle and test
methods. Specifically, if a developer sets the ExtensionContextScope to
TEST_METHOD — for example, by configuring the following configuration
parameter as a JVM system property or in a `junit-platform.properties`
file — the SpringExtension already supports dependency injection from
the current, @⁠Nested ApplicationContext in @⁠Autowired fields in an
enclosing class of the @⁠Nested test class.

junit.jupiter.extensions.testinstantiation.extensioncontextscope.default=test_method

However, there are two scenarios that fail as of Spring Framework
6.2.12.

1. @⁠TestConstructor configuration in @⁠Nested class hierarchies.
2. Field injection for bean overrides (such as @⁠MockitoBean) in
   @⁠Nested class hierarchies.

Commit 82c34f7b51 fixed the SpringExtension to support scenario #2
above.

To fix scenario #1, this commit revises
BeanOverrideTestExecutionListener's injectField() implementation to
look up the fields to inject for the "current test instance" instead of
for the "current test class".

This commit also introduces tests for both scenarios.

See gh-34576
See gh-35676
Closes gh-35680
2025-10-22 17:00:44 +02:00
Brian Clozel a5141b187a Fix '**' parsing within a PathPattern segment
Prior to this commit, a regexp path segment ending with a double wilcard
(like "/path**") would be incorrectly parsed as a double wildcard
segment ("/**").

This commit fixes the incorrect parsing.

See gh-35679
2025-10-22 12:21:57 +02:00
Brian Clozel d3c1e678c2 Support wildcard path elements at the start of path patterns
Prior to this commit, the `PathPattern` and `PathPatternParser` would
allow multiple-segments matching and capturing with the following:

* "/files/**" (matching 0-N segments until the end)
* "/files/{*path}" (matching 0-N segments until the end and capturing
  the value as the "path" variable)

This would be only allowed as the last path element in the pattern and
the parser would reject other combinations.

This commit expands the support and allows multiple segments matching at
the beginning of the path:

* "/**/index.html" (matching 0-N segments from the start)
* "/{*path}/index.html" (matching 0-N segments until the end and capturing
  the value as the "path" variable)

This does come with additional restrictions:

1. "/files/**/file.txt" and "/files/{*path}/file.txt" are invalid,
   as multiple segment matching is not allowed in the middle of the
   pattern.
2. "/{*path}/files/**" is not allowed, as a single "{*path}" or "/**"
   element is allowed in a pattern
3. "/{*path}/{folder}/file.txt"  "/**/{folder:[a-z]+}/file.txt" are
   invalid because only a literal pattern is allowed right after
   multiple segments path elements.

Closes gh-35679
2025-10-22 12:21:57 +02:00
Sam Brannen 82c34f7b51 Introduce isAutowirableConstructor(Executable,PropertyProvider) in TestConstructorUtils
This commit introduces a new isAutowirableConstructor(Executable, PropertyProvider)
overload in TestConstructorUtils and deprecates all other existing variants
for removal in 7.1.

Closes gh-35676
2025-10-21 17:37:04 +02:00
Sam Brannen cb0f26a152 Use consistent naming for Bean Override test classes
cherry-picked from c6e5cfe03d
2025-10-21 16:25:12 +02:00
Sam Brannen bccfbfd630 Fix previous commit for 6.2.x compatibility
See gh-35674
2025-10-21 15:37:35 +02:00
Brian Clozel 506b76032f Add missing reflection hints for JdbcUtils
This commit adds the missing reflection hints for `JdbcUtils`, as this
class reflects on `java.sql.Types` public fields.

Fixes gh-35674
2025-10-21 13:50:13 +02:00
Juergen Hoeller 7adcd99ea2 Polishing 2025-10-21 00:59:56 +02:00
Juergen Hoeller 765e30c3a6 Polishing 2025-10-18 15:30:15 +02:00
HJC96 d7fc07e73c Fix typos
Closes gh-35656
Signed-off-by: HJC96 <gkswlcjs2@naver.com>
2025-10-17 15:46:27 +02:00
Brian Clozel 18a879779e Next development version (v6.2.13-SNAPSHOT) 2025-10-16 09:32:20 +02:00
Juergen Hoeller c53132ecdf Polishing 2025-10-15 19:40:09 +02:00
rstoyanchev 03c3ec1577 Fall back on remoteHost if remoteAddress is null
See gh-35589
2025-10-15 16:42:40 +01:00
rstoyanchev c88bfc54c9 Refactor state management in StompSubProtocolHandler
Closes gh-35591
2025-10-15 12:31:42 +01:00
Sam Brannen a96558c965 Revise commit 01acb80501
See gh-35631
2025-10-15 12:48:52 +02:00
Sam Brannen 1612b7c5db Remove test prefixes 2025-10-15 11:28:49 +02:00
Sam Brannen 01acb80501 Improve exception handling in ConfigurationClassBeanDefinitionReader
Thanks to a proposal from @wilkinsona, this commit introduces a
try-catch block in loadBeanDefinitions(...) which throws an
IllegalStateException that provides context regarding the configuration
class and cause of the failure.

Closes gh-35631

Co-authored-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
2025-10-15 11:26:06 +02:00
Juergen Hoeller f4438ce9e3 Upgrade to Reactor 2024.0.11 and Micrometer 1.14.12
Includes Netty 4.1.128

Closes gh-35638
Closes gh-35640
2025-10-14 19:21:34 +02:00
Juergen Hoeller 5033b9d3c5 Reset by-type cache for Object after registering a new singleton
Closes gh-35634
2025-10-14 19:20:57 +02:00
Juergen Hoeller d733023a29 Consistently apply fallback attribute to proxy definition as well
See gh-35627
2025-10-14 19:17:57 +02:00
Schäfer, H.H. (Hans Hosea) df67c1cf2d 35626: defaultCandidate for scoped proxies
Signed-off-by: Schäfer, H.H. (Hans Hosea) <HansHosea.Schaefer@ing.de>
2025-10-14 19:07:03 +02:00
rstoyanchev 05814f7a42 Polishing contribution
Closes gh-35625
2025-10-14 16:49:10 +01:00
Marius Lichtblau ba2bb08589 Release DataBuffer in AbstractCharSequenceDecoder
if String creation fails

See gh-35625

Signed-off-by: Marius Lichtblau <marius@lichtblau.io>
2025-10-14 16:49:10 +01:00
Edgar Asatryan 141df5291d Prevent NoClassDefFoundError when Jetty Reactive HttpClient not on classpath
Closes gh-35608

Signed-off-by: Edgar Asatryan <nstdio@gmail.com>
2025-10-14 16:49:10 +01:00
Sébastien Deleuze dcfe33f427 Fix Hibernate Javadoc to avoid a redirect 2025-10-14 17:40:44 +02:00
Juergen Hoeller 3a61460f91 Use JarFile#entries() instead of #stream() for consistent entry paths
Closes gh-35617
2025-10-14 11:23:34 +02:00
Brian Clozel ee284f2ee6 Add "forEachByte" variant to DataBuffer
As reported in gh-34651, `DataBuffer#getByte` can be inefficient for
some implementations, as bound checks are performed for each call.

This commit introduces a new `forEachByte` method that helps with
traversing operations without paying the bound check cost for each byte.

Closes gh-35623
2025-10-13 18:28:34 +02:00
Sam Brannen 2591cab561 Polishing 2025-10-13 15:12:21 +02:00
Sam Brannen 8456cd1e74 Polish contribution
See gh-35587
2025-10-13 15:12:21 +02:00
Igor Murzich 7699b4af9c Retain order of produces media types in @⁠ExceptionHandler
Closes gh-35587

Signed-off-by: Igor Murzich <imurzich@gmail.com>
2025-10-13 15:12:21 +02:00
Juergen Hoeller 6c5de48059 Ignore SQL state 3B001 in HSQLDB exception message as well
Closes gh-35618
See gh-35564
2025-10-13 15:10:20 +02:00
Juergen Hoeller 9f678ce698 Upgrade to Jetty 12.0.28, Undertow 2.3.20, RxJava 3.1.12, Aalto 1.3.4, Gson 2.13.2, Selenium 4.36, HtmlUnit 4.17, Mockito 5.20, AssertJ 3.27.6 2025-10-11 15:12:21 +02:00
Juergen Hoeller 467a484df6 Polishing
See gh-35460
2025-10-11 15:11:16 +02:00
Juergen Hoeller 83efe8cff4 Remove deprecation on CandidateComponentsIndex(Loader)
See gh-35472
2025-10-11 15:10:42 +02:00
rstoyanchev 2c83144946 Use getRemoteAddr in ServletServerHttpRequest
Closes gh-35589
2025-10-10 17:24:48 +01:00
rstoyanchev c165dd5e0e Update Javadoc of reactive WebSocketHandler
Replace suggestion to use zip with and operator.

Closes gh-35572
2025-10-10 17:23:03 +01:00
Juergen Hoeller 449b85f446 Avoid overhead for parsing plain values and simple placeholders
Closes gh-35594
2025-10-10 17:03:34 +02:00
Juergen Hoeller c2a66e723f Polishing 2025-10-09 20:34:03 +02:00
Juergen Hoeller 2ee34a5632 Add MySQLTableMetaDataProvider for correct generated-keys support
Closes gh-35593
2025-10-09 20:30:25 +02:00
Juergen Hoeller 1bc82d241a Remove deprecation on CandidateComponentsIndex(Loader)
Closes gh-35472
2025-10-09 20:26:59 +02:00
Juergen Hoeller 80e7ee321e Mark bootstrap thread for entire finishBeanFactoryInitialization phase
Closes gh-35398
2025-10-06 14:08:03 +02:00
Juergen Hoeller ecd3dd8883 Consistent local synchronization in getObjectFromFactoryBean
Closes gh-35545
2025-10-03 17:29:14 +02:00
Juergen Hoeller 332953c9a4 Align BatchUpdateException handling among SQLExceptionTranslator variants
Closes gh-35547
2025-10-03 14:51:15 +02:00
Sam Brannen 1cdd56bf02 Log multiple primary bean detection in DefaultListableBeanFactory
Prior to this commit, a NoUniqueBeanDefinitionException was thrown when
multiple primary beans were detected within a given set of beans, but
nothing was logged. For use cases where the exception is handled by
infrastructure code, it may not be obvious to the developer what the
problem is.

To address that, a TRACE message is now logged whenever multiple
competing primary beans are detected in DefaultListableBeanFactory.

Closes gh-35550
2025-10-03 14:09:52 +02:00
Juergen Hoeller 3041071269 Consistently apply useCaches for single Resource lookup
Closes gh-35465
2025-10-02 21:53:47 +02:00
Juergen Hoeller 2da821389c Remove redundant object allocation in cglib proxy method calls
Reformatted with Spring patch markers and backported to 6.2.12

Closes gh-35543
2025-10-02 21:53:34 +02:00
Juergen Hoeller d484e4f3ff Ignore SQL state 3B001 in releaseSavepoint (for HSQLDB)
Closes gh-35564
2025-10-02 13:01:30 +02:00
Juergen Hoeller 74dc61b8c4 Fall back to local synchronization in getObjectFromFactoryBean
Closes gh-35545
2025-10-02 13:01:03 +02:00
Sam Brannen 717358b56b Short circuit ClassUtils.findPubliclyAccessibleMethodIfPossible(...)
Once we find a publicly accessible method, there is no need to continue
traversing the type hierarchy.

See gh-35556
2025-10-02 11:44:54 +02:00
Sébastien Deleuze 836634c47f Upgrade CI workflow from Java 24 to Java 25 2025-10-02 10:19:42 +02:00
Juergen Hoeller a6f6ecfe6c Revise getPubliclyAccessibleMethodIfPossible to rely on Module#isExported
This avoids reflection and cache access for regular public and exported types.

Closes gh-35556
2025-10-01 19:56:23 +02:00
Juergen Hoeller e3da26ebbd Clarify event parameter type for multiple mapped classes
Closes gh-35506
2025-10-01 19:55:42 +02:00
Maziyar Bahramian e1c008f5a3 Fix URI Patterns docs for WebMVC and WebFlux
Closes gh-35551
Signed-off-by: Maziyar Bahramian <maziyar.bahramian@gmail.com>
2025-10-01 19:39:57 +02:00
Sébastien Deleuze cb849a7071 Add a test for CGLIB Enhancer Kotlin refinements
This commit adds a reproducer for the change of behavior introduced via
https://youtrack.jetbrains.com/issue/KT-76667. The test is only broken
with Kotlin 2.2.20+ without the related fix (see previous commit).

Closes gh-35487
2025-10-01 19:21:40 +02:00
Juergen Hoeller 3e37279db6 Make CGLIB Enhancer compatible with Kotlin 2.2.20+
This commit refines Enhancer#emitMethods to support the changes
introduced by https://youtrack.jetbrains.com/issue/KT-76667.

See gh-35487
2025-10-01 19:14:14 +02:00
rstoyanchev b3264ec2a8 Fix typo 2025-10-01 16:13:40 +01:00
rstoyanchev df860fd3cd Polishing contribution
Closes gh-35493
2025-10-01 14:45:18 +01:00
Réda Housni Alaoui 636523a2f5 AbstractMockHttpServletRequestBuilder#buildRequest is not idempotent
See gh-35493

Signed-off-by: Réda Housni Alaoui <reda-alaoui@hey.com>
2025-10-01 14:44:23 +01:00
rstoyanchev a19b51b7e0 Handle invalid position in ResourceHttpMessageWriter
Closes gh-35536
2025-10-01 14:44:05 +01:00
rstoyanchev fbdece6759 Polishing in ResourceHttpMessageWriter
See gh-35536
2025-10-01 14:42:01 +01:00
Sam Brannen 64d42fefda Fix idref example in reference manual
Closes gh-35560
2025-10-01 13:19:54 +02:00
Sam Brannen 447cfa18e9 Polishing 2025-10-01 13:19:25 +02:00
Sam Brannen ec3d9d6253 Upgrade to JUnit 5.14
Closes gh-35555
2025-09-30 12:43:53 +02:00
Sam Brannen 5cd2cb38e1 Make AbstractTestNGSpringContextTests thread-safe regarding tracked exceptions
Prior to this commit, AbstractTestNGSpringContextTests was not
thread-safe with regard to tracked exceptions.

To address that, AbstractTestNGSpringContextTests now tracks the test
exception via a ThreadLocal.

Closes gh-35528
2025-09-25 17:51:39 +02:00
rstoyanchev e9fb5eb38a Respect forwarded path in UrlHandlerFilter
Closes gh-35509
2025-09-25 12:19:56 +01:00
rstoyanchev 5a858915ea Revise parsed path handling in UrlHandlerFilter
Closes gh-35538
2025-09-24 19:08:55 +01:00
Brian Clozel d85a020e4e Improve Task Javadoc about Runnable wrapping
Closes gh-35394
2025-09-19 18:05:02 +02:00
Brian Clozel 0cc79ba366 Catch EOFException in IntrospectingClientHttpResponse
Prior to this commit, the `IntrospectingClientHttpResponse` would try
and read the HTTP response stream in order to check for the presence of
a non-empty message body.

Developers reported that in some cases, an `EOFException` is thrown
instead of returning -1 from the `read()` method. This commit ensures
that this case is taken into account and that we report the response as
an empty body in these cases.

Closes gh-35361
2025-09-19 17:49:12 +02:00
Sam Brannen 1e29911292 Upgrade to AssertJ 3.27.5 2025-09-19 11:23:08 +02:00
Juergen Hoeller 931686a5ee Upgrade to SnakeYAML 2.5, Protobuf 4.32.1, ActiveMQ 5.17.7 and Artemis 2.42, EasyMock 5.6, AssertJ 3.27.4, XMLUnit 2.10.4, Dom4J 2.2 2025-09-17 18:18:35 +02:00
Juergen Hoeller bf715ac23e Polishing 2025-09-17 18:10:19 +02:00
Brian Clozel b213344d25 Fix synchronization in ResponseBodyEmitter
See gh-35423
Fixes gh-35466

(cherry picked from commit 20e1149dde)
2025-09-17 18:07:45 +02:00
Stéphane Nicoll 0a48984fab Suppress deprecating warnings for getInstanceSupplier() method as well
This commit fixes code generation for a bean produced by a protected
factory method. Previously only the code generated for public methods,
i.e. without a dedicated instance supplier method, was handled.

Closes gh-35486
2025-09-16 16:08:15 +02:00
Brian Clozel cbdd107799 Next development version (v6.2.12-SNAPSHOT) 2025-09-11 09:40:23 +02:00
Juergen Hoeller d17601e01c Upgrade to Undertow 2.3.19, RxJava 3.1.11, Aalto 1.3.3 2025-09-10 18:38:20 +02:00
Juergen Hoeller 5b387615c6 Clarify intended nestedTransactionAllowed default in JpaTransactionManager
Closes gh-35212
2025-09-10 18:06:44 +02:00
Sam Brannen 0e3e34bee0 Find annotations on parameters in overridden non-public methods
Prior to this commit, annotations were not found on parameters in an
overridden method unless the method was public. Specifically, the
search algorithm in AnnotatedMethod did not consider a protected or
package-private method in a superclass to be a potential override
candidate. This affects parameter annotation searches in
spring-messaging, spring-webmvc, spring-webflux, and any other
components that use or extend AnnotatedMethod.

To address that, this commit revises the search algorithm in
AnnotatedMethod to consider all non-final declared methods as potential
override candidates, thereby aligning with the search logic in
AnnotationsScanner for the MergedAnnotations API.

Closes gh-35349
2025-09-10 14:24:24 +02:00
Sam Brannen 4745c7cf3c Name local variables consistently 2025-09-10 14:08:20 +02:00
Juergen Hoeller 275fb52ad6 Upgrade to Reactor 2024.0.10 and Micrometer 1.14.11
Closes gh-35454
Closes gh-35455
2025-09-09 18:45:38 +02:00
Juergen Hoeller 7f9aa39748 Polishing 2025-09-09 18:45:04 +02:00
Taeik Lim c788554b1d Avoid thread pinning in SseEmitter, ResponseBodyEmitter
Closes gh-35423

Signed-off-by: Taeik Lim <sibera21@gmail.com>
2025-09-09 16:38:10 +02:00
Sébastien Deleuze 9e8c64011d Make JsonPathAssertions#isEqualTo parameter nullable
Closes gh-35445
2025-09-09 11:25:58 +02:00
Juergen Hoeller ebb8e34570 Upgrade to Jetty 12.0.26, Jetty Reactive HttpClient 4.0.11, Netty 4.1.127, HtmlUnit 4.16 2025-09-08 18:11:27 +02:00
Juergen Hoeller 9ba954c330 Fix FileSystemUtils for Windows/Linux path difference
See gh-35443
2025-09-08 17:51:58 +02:00
Juergen Hoeller ba52164373 Provide graceful fallback for non-default NIO file systems
Closes gh-35443
2025-09-08 17:28:45 +02:00
rstoyanchev 977582fced Document data binding for functional endpoints
Closes gh-35367
2025-09-08 10:12:20 +01:00
Sam Brannen 64721b3bc0 Polish formatting 2025-09-03 16:24:56 +02:00
Sam Brannen 02f0f92a72 Polish contribution
See gh-35400
2025-09-03 16:22:55 +02:00
Lukáš Kvídera db9e938ec4 Detect Informix error codes as DuplicateKeyException
Closes gh-35400

Signed-off-by: Lukáš Kvídera <kvideral@qwsome.eu>
2025-09-03 16:20:19 +02:00
Juergen Hoeller 3a4315bf16 Keep mainThreadPrefix exposed until background init threads finished
Closes gh-35409
2025-09-03 15:45:12 +02:00
Sam Brannen 33fe8d29c1 Document potential need to use Mockito.doXxx() to stub a @⁠MockitoSpyBean
Closes gh-35410
2025-09-03 14:52:58 +02:00
Sam Brannen b741632e99 Polish wording in web sections 2025-08-29 17:25:15 +02:00
Tran Ngoc Nhan cd208797e2 Fix links to Reactive Libraries and RestTemplate
Closes gh-35392

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-08-29 17:23:13 +02:00
Brian Clozel 764336f0f2 Fix Jetty DataBufferFactory memory leak
Prior to this commit, gh-32097 added native support for Jetty for both
client and server integrations. The `JettyDataBufferFactory` was
promoted as a first class citizen, extracted from a private class in the
client support. To accomodate with server-side requirements, an extra
`buffer.retain()` call was performed.
While this is useful for server-side support, this introduced a bug in
the data buffer factory, as wrapping an existing chunk means that this
chunk is already retained.

This commit fixes the buffer factory implementation and moved existing
tests from mocks to actual pooled buffer implementations from Jetty.
The extra `buffer.retain()` is now done from the server support, right
before wrapping the buffer.

Fixes gh-35319
2025-08-27 13:36:34 +02:00
Sam Brannen 4903fee939 Permit @⁠Nullable value in ResponseCookie from*() factory methods
Closes gh-35377
2025-08-26 11:01:29 +02:00
Sam Brannen 6978f0a398 Document terms and units in DataSize.parse(...) methods
Closes gh-35298
2025-08-24 14:02:04 +02:00
Juergen Hoeller f62519bb55 Add cancelRemainingTasksOnClose flag for enforcing early interruption
Closes gh-35372
2025-08-24 10:31:01 +02:00
Juergen Hoeller 0e2af5d113 Avoid default AutoCloseable implementation in ExecutorService on JDK 19+
Consistently calls shutdown() unless a specific close() method has been provided in a subclass.

Closes gh-35316
2025-08-24 10:30:48 +02:00
Daniel Garnier-Moiroux ed7c3d737c Fix broken link in WebDriver docs
Closes gh-35374

Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
2025-08-23 13:41:40 +02:00
Juergen Hoeller 01b24f2644 Upgrade to Protobuf 4.32, HtmlUnit 4.15, Mockito 5.19 2025-08-22 23:05:13 +02:00
Juergen Hoeller 4a4cf8a787 Remove erroneous javadoc symbol 2025-08-22 22:38:34 +02:00
Juergen Hoeller 55181fa1c9 Polishing 2025-08-22 22:00:52 +02:00
Juergen Hoeller 300ae841ce Align setBeanResolver nullability with getBeanResolver
Includes consistent javadoc for all applicable methods.

Closes gh-35371
2025-08-22 22:00:22 +02:00
Juergen Hoeller c248f94e5a Cache bean type next to primary bean names (on singleton creation)
This avoids singleton access for type checks in hasPrimaryConflict.

Closes gh-35330
2025-08-22 21:59:38 +02:00
Sam Brannen 19d5ec6781 Improve documentation for ApplicationEvents to clarify recommended usage
See gh-35335
2025-08-20 16:42:22 +02:00
khj68 c0b71f8999 Improve Javadoc of ApplicationEvents to clarify preferred usage
This commit reorders and clarifies the usage instructions for
ApplicationEvents to:

1. Recommend method parameter injection as the primary approach, since
   ApplicationEvents has a per-method lifecycle
2. Clarify that ApplicationEvents is not a general Spring bean and
   cannot be constructor-injected
3. Explicitly state that field injection is an alternative approach

This addresses confusion where developers expect ApplicationEvents to
behave like a regular Spring bean eligible for constructor injection.

See gh-35297
Closes gh-35335

Signed-off-by: khj68 <junthewise@gmail.com>
2025-08-20 16:31:41 +02:00
Sam Brannen 5d214c2624 Polishing 2025-08-20 16:31:41 +02:00
Sam Brannen 6d710d482a Find annotation on overridden method in type hierarchy with unresolved generics
Prior to this commit, the MergedAnnotations support (specifically
AnnotationsScanner) and AnnotatedMethod did not find annotations on
overridden methods in type hierarchies with unresolved generics.

The reason for this is that ResolvableType.resolve() returns null for
such an unresolved type, which prevents the search algorithms from
considering such methods as override candidates.

For example, given the following type hierarchy, the compiler does not
generate a method corresponding to processOneAndTwo(Long, String) for
GenericInterfaceImpl. Nonetheless, one would expect an invocation of
processOneAndTwo(Long, String) to be @⁠Transactional since it is
effectively an invocation of processOneAndTwo(Long, C) in
GenericAbstractSuperclass, which overrides/implements
processOneAndTwo(A, B) in GenericInterface, which is annotated with
@⁠Transactional.

However, the MergedAnnotations infrastructure currently does not
determine that processOneAndTwo(Long, C) is @⁠Transactional since it is
not able to determine that processOneAndTwo(Long, C) overrides
processOneAndTwo(A, B) because of the unresolved generic C.

interface GenericInterface<A, B> {

    @⁠Transactional
    void processOneAndTwo(A value1, B value2);
}

abstract class GenericAbstractSuperclass<C> implements GenericInterface<Long, C> {

    @⁠Override
    public void processOneAndTwo(Long value1, C value2) {
    }
}

static GenericInterfaceImpl extends GenericAbstractSuperclass<String> {
}

To address such issues, this commit changes the logic in
AnnotationsScanner.hasSameGenericTypeParameters() and
AnnotatedMethod.isOverrideFor() so that they use
ResolvableType.toClass() instead of ResolvableType.resolve(). The
former returns Object.class for an unresolved generic which in turn
allows the search algorithms to properly detect method overrides in
such type hierarchies.

Closes gh-35342
2025-08-19 12:28:12 +02:00
Stefano Cordio ed28390d24 Refine @Contract Javadoc
This commit removes references to the `pure` attribute.
Relates to gh-33820.

Closes gh-35285
Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
2025-08-14 16:12:46 +02:00
Stéphane Nicoll e2085063f6 Next development version (v6.2.11-SNAPSHOT) 2025-08-14 09:55:02 +02:00
Stéphane Nicoll edda4731e1 Build against Java 24
Closes gh-35326
2025-08-14 09:06:18 +02:00
Stéphane Nicoll 9fa2d7d190 Upgrade to Jackson 2.18.4.1
Closes gh-35322
2025-08-14 08:38:58 +02:00
Stéphane Nicoll c30427fd4e Upgrade to Netty 4.1.124.Final
Closes gh-35321
2025-08-14 08:38:34 +02:00
Juergen Hoeller 1d908f1847 Upgrade to Reactor 2024.0.9 and Micrometer 1.14.10
Includes Groovy 4.0.28, JRuby 9.4.13, Jetty 12.0.25, Caffeine 3.2.2, Protobuf 4.31.1, Selenium 4.35, HtmlUnit 4.14

Closes gh-35312
Closes gh-35313
2025-08-13 00:04:31 +02:00
Sam Brannen 37b076be51 Support multiple result sets in ScriptUtils.executeSqlScript()
Prior to this commit, ScriptUtils.executeSqlScript() treated every
statement within the script as if it were a single insert/update/delete
statement. This disregarded the fact that the execution of a JDBC
Statement can result in multiple individual statements, some of which
result in a ResultSet and others that result in an update count.

For example, when executing a stored procedure on Sybase, ScriptUtils
did not execute all statements within the stored procedure.

To address that, this commit revises the implementation of
ScriptUtils.executeSqlScript() so that it handles multiple results and
differentiates between result sets and update counts.

Closes gh-35248
2025-08-11 17:44:39 +03:00
Juergen Hoeller a9453a5959 Polishing 2025-08-11 14:32:45 +02:00
Juergen Hoeller 3781ba223e Optimize NIO path resolution in PathEditor
Closes gh-35304
2025-08-11 14:32:39 +02:00
Sam Brannen f11a1e6f82 Polish tests 2025-08-11 11:27:10 +03:00
rstoyanchev ffc785471b Fix checkstyle error 2025-08-08 12:31:13 +01:00
rstoyanchev 6e2fbfe108 Polishing contribution
Closes gh-35232
2025-08-08 11:50:07 +01:00
秦利斌 968e037503 Add documentation of RequestMapping about SpEL
Signed-off-by: 秦利斌 <68638598+Allan-QLB@users.noreply.github.com>
2025-08-08 11:37:25 +01:00
rstoyanchev f0a9f649c1 Allow null in ProblemDetail#type
See gh-35294
2025-08-08 11:36:53 +01:00
rstoyanchev 600d6c6fc0 Update contribution
Closes gh-34721
2025-08-08 11:31:21 +01:00
giampaolo 7a55ce48a9 Handle CancellationException in JdkClientHttpRequest
Handle CancellationException in order to throw an HttpTimeoutException
when the timeout handler caused the cancellation.

See gh-34721

Signed-off-by: giampaolo <giampaorr@gmail.com>

fix: use timeoutHandler with a flag isTimeout

    Closes gh-33973

    Signed-off-by: giampaolo <giampaorr@gmail.com>
2025-08-08 11:31:21 +01:00
Juergen Hoeller 5df9fd4eff Polishing (aligned with main) 2025-08-06 19:01:18 +02:00
Juergen Hoeller da13a24604 Allow any @Transactional propagation for listener with BEFORE_COMMIT phase
Closes gh-35150
2025-08-01 21:15:56 +02:00
Juergen Hoeller 67e88f3c20 Align task execution tracking and thread interruption on shutdown
Closes gh-35254
2025-08-01 21:15:25 +02:00
Patrick Strawderman 24e66b63d1 Refine StringUtils#uriDecode and update documentation
Refine the StringUtils#uriDecode method in the following ways:
- Use a StringBuilder instead of ByteArrayOutputStream, and only decode
  %-encoded sequences.
- Use HexFormat.fromHexDigits to decode hex sequences.
- Decode to a byte array that is only allocated if encoded sequences are
  encountered.

This commit adds another optimization mainly for the use case where
there is no encoded sequence, and updates the Javadoc of both
StringUtils#uriDecode and UriUtils#decode to match the implementation.

Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>
Co-Authored-by: Sebastien Deleuze <sebastien.deleuze@broadcom.com>

Closes gh-35253
2025-07-29 21:44:26 +02:00
Juergen Hoeller f3832c7262 Add note on SQL types with SqlBinaryValue/SqlCharacterValue
Closes gh-34786
2025-07-28 22:06:38 +02:00
Juergen Hoeller 16e99f289c Accept support for generated keys column name array on HSQLDB/Derby
Closes gh-34790
2025-07-28 22:04:18 +02:00
Juergen Hoeller 642e554c52 Process PostgreSQL-returned catalog/schema names in given case
Closes gh-35064
2025-07-28 20:28:45 +02:00
Juergen Hoeller 4f6304707d Polishing 2025-07-25 22:40:15 +02:00
Juergen Hoeller 3c112703d9 Introduce useCaches flag on UrlResource (for URLConnection access)
Propagated from PathMatchingResourcePatternResolver's setUseCaches.

Closes gh-35218
2025-07-25 22:40:09 +02:00
Juergen Hoeller 8c44a61033 Invalidate cache entries for matching types after singleton creation
Closes gh-35239
2025-07-25 22:38:57 +02:00
Sébastien Deleuze 5e338ef1b8 Make MessageSource locale parameter nullable
Closes gh-35230
2025-07-23 16:02:38 +02:00
Sam Brannen 445da24631 Upgrade to JUnit 5.13.4
Closes gh-35229
2025-07-21 13:17:38 +03:00
Brian Clozel 6d97791f5e Next development version (v6.2.10-SNAPSHOT) 2025-07-17 09:55:21 +02:00
Juergen Hoeller a4ec25d9ec Upgrade to MockK 1.13.17 2025-07-16 15:31:46 +02:00
Juergen Hoeller 0fc043f762 Upgrade to Netty 4.1.123, Selenium 4.34, XMLUnit 2.10.3 2025-07-15 21:15:16 +02:00
Juergen Hoeller 54732605a5 Backport nullability refinements for Micrometer
See gh-35170
2025-07-15 20:56:36 +02:00
Juergen Hoeller 12a6098eae Upgrade to Reactor 2024.0.8 and Micrometer 1.14.9
Closes gh-35201
Closes gh-35202
2025-07-15 16:00:00 +02:00
Juergen Hoeller f86034b528 Drop final declaration from doFilter entry point (for CGLIB proxying)
Closes gh-35198
2025-07-15 15:59:23 +02:00
Juergen Hoeller 21807832c8 Upgrade to Jetty 12.0.23, Netty 4.1.122, Gson 2.13.1, Caffeine 3.2.1 2025-07-13 16:33:52 +02:00
Juergen Hoeller 2434bb1540 Polishing 2025-07-13 16:33:37 +02:00
Brian Clozel 4063cb5b9a Publish releases using Central Portal
Closes gh-35188
2025-07-12 18:42:03 +02:00
Juergen Hoeller 4277682a5c Catch InaccessibleObjectException next to IllegalAccessException
Closes gh-35190
2025-07-11 22:44:11 +02:00
Juergen Hoeller ba6166a02d Prefer most abstract method in getPubliclyAccessibleMethodIfPossible
Closes gh-35189
2025-07-11 22:42:36 +02:00
Juergen Hoeller c754bfe7e6 Fall back to getPubliclyAccessibleMethodIfPossible on IllegalAccessException
Closes gh-34028
2025-07-11 22:41:50 +02:00
chenggwang 5aa15923cf Make targetBeanName field in AbstractBeanFactoryBasedTargetSource protected
Prior to this commit, subclasses of AbstractBeanFactoryBasedTargetSource
referenced the targetBeanName via getTargetBeanName() which throws an
IllegalStateException if the targetBeanName has not yet been set.

This commit changes the visibility of the targetBeanName field from
private to protected in order to facilitate direct access through
this.targetBeanName where no assertion is needed.

By doing so, we avoid exceptions in logging and toString()
implementations in subclasses.

Closes gh-35172

Signed-off-by: chenggwang <90715678+chenggwang@users.noreply.github.com>
Co-authored-by: Sam Brannen <104798+sbrannen@users.noreply.github.com>
2025-07-11 15:51:10 +02:00
Juergen Hoeller 25b4e29f5e Polishing 2025-07-10 19:33:51 +02:00
Juergen Hoeller a0c083619f Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
Sam Brannen 983fdebdbb Document how to register runtime hints for convention-based conversion
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
Sam Brannen 95ad25ebf2 Polish AOT section of the reference docs 2025-07-09 17:39:29 +02:00
rstoyanchev 9670388e0c Support conditional streaming with ResponseEntity<?>
Closes gh-35153
2025-07-09 12:44:12 +01:00
Sam Brannen 3dc22379a0 Register runtime hints for Instant-to-Timestamp conversion
If an application depends on automatic type conversion from
java.time.Instant to java.sql.Timestamp, the ObjectToObjectConverter
performs the conversion based on convention, by using reflection to
invoke Timestamp.from(Instant).

However, when running in a native image a user needs to explicitly
register runtime hints for that particular use of reflection.

To assist users who are running their applications in a native image,
this commit automatically registers the necessary runtime hints for
Timestamp.from(Instant) so that users do not have to.

See gh-35175
Closes gh-35156
2025-07-09 12:35:10 +02:00
Sam Brannen 7900315f23 Introduce Date-to-Instant and Instant-to-Date converters
In order to avoid unnecessary use of reflection and to simplify native
image deployments, this commit introduces explicit support for
automatic conversions from java.util.Date to java.time.Instant and vice
versa.

To achieve that, this commit introduces an InstantToDateConverter and a
DateToInstantConverter and registers them automatically in
DefaultConversionService.

See gh-35156
Closes gh-35175
2025-07-09 12:31:44 +02:00
rstoyanchev 6bd12e8680 Clear CONTENT_DISPOSITION before error handling
Closes gh-35116
2025-07-09 08:59:26 +01:00
Juergen Hoeller 1051592ae8 Upgrade to Selenium 4.33 and HtmlUnit 4.13 2025-07-07 14:36:01 +02:00
Juergen Hoeller 3bd96f72a6 Leniently tolerate null bean as aspect instance
Closes gh-35074
2025-07-07 14:26:19 +02:00
Sam Brannen ad00aebaa3 Improve Javadoc for caching annotations 2025-07-07 12:19:49 +02:00
Sam Brannen d07ed31fed Support @⁠CacheConfig("myCache") declarations for simplified config
The @⁠CacheConfig section of the reference manual provides an example
that declares @⁠CacheConfig("books").

However, unlike the @⁠Cacheable, @⁠CachePut, and @⁠CacheEvict
annotations, @⁠CacheConfig currently does not have a `value` alias for
the `cacheNames` attribute. Thus, the example in the reference manual
does not compile, and @⁠CacheConfig(cacheNames = "books") would be the
supported way to declare that.

The driving factor for this commit is therefore to provide a simplified
and consistent programming model for users that only need to define
default cache names at the type level (like in the existing example in
the reference manual).

To address that, this commit introduces a `value` alias for
`cacheNames` in @⁠CacheConfig.

See gh-35096
Closes gh-35152

(cherry picked from commit 6091453feb)
2025-07-07 12:17:47 +02:00
Sam Brannen 75b7f5efcf Upgrade to Gradle 8.14.3
Closes gh-35162
2025-07-05 14:04:18 +02:00
Juergen Hoeller 65e5c14245 Polishing 2025-07-04 18:20:27 +02:00
Juergen Hoeller 9596b70b2a Consistent nullability and exception declarations
Closes gh-35159
2025-07-04 18:20:19 +02:00
Sam Brannen 292ea1769f Upgrade to JUnit 5.13.3
Closes gh-35103
2025-07-04 17:17:39 +02:00
Sam Brannen 5da8d5e795 Remove unnecessary final declarations in JmsTemplate
This commit removes unnecessary `final` declarations for parameters that
are "effectively final".
2025-07-04 11:38:30 +02:00
Sam Brannen 133f330850 Declare remaining messageSelector parameters in JmsOperations as @⁠Nullable
Closes gh-35151
2025-07-04 11:35:49 +02:00
Jiandong Ma b6675edb92 Declare messageSelector parameters in JmsOperations as @⁠Nullable
See gh-35151

Signed-off-by: Jiandong Ma <jiandong.ma.cn@gmail.com>
2025-07-03 19:17:49 +02:00
Juergen Hoeller 15364cf59f Polishing 2025-07-01 17:51:23 +02:00
Juergen Hoeller 978590161a Upgrade to Checkstyle 10.26.1 2025-07-01 17:51:14 +02:00
Sam Brannen 0828fe8e1c Remove obsolete update_copyright_headers.sh script
Closes gh-35142
2025-07-01 11:29:21 +02:00
Phillip Webb 89b8b1a468 Prevent cache pollution by storing only the factories
Update `SpringFactoriesLoader` so that the cache stores only the
factories and not the complete loader.

Prior to this commit, if a cache entry was added with the thread
context classloader, the loader instance would be added and the
classloader stored. If the thread context classloader subsequently
changes, and a call is made to `forDefaultResourceLocation` with
`null` for the classloader, the cached entry would be used which
contains the older classloader.

Closes gh-34732
2025-07-01 11:01:48 +02:00
Sam Brannen 900dd0c3eb Polish contribution
See gh-35132
2025-06-30 17:35:43 +02:00
Jeroen Meijer 41cb6ae1a5 Add getter for OverflowStrategy in ConcurrentWebSocketSessionDecorator
This commit also includes a test for all configured properties.

Closes gh-35132

Signed-off-by: Jeroen Meijer <jjgmeijer@gmail.com>
2025-06-30 17:30:29 +02:00
rstoyanchev 55634f972c Use preset content-type for streaming response
Closes gh-35130
2025-06-30 15:34:14 +01:00
Stéphane Nicoll e88b70e6ad Slice bean registrations in separate file if necessary
The compiler has a constants pool limit of 65536 entries per source file
which can be hit with a very large amount of beans to register in the
bean factory.

This commit makes sure to create separate source files if the number
of beans to register is very large. The main generated source file
delegate to those.

Closes gh-35044
2025-06-30 12:53:38 +02:00
Sam Brannen 1ad05db877 Simplify dependency management for JUnit artifacts
This commit simplifies our dependency management for JUnit artifacts by
making use of the junit-jupiter and junit-platform-suite aggregator
artifacts.

Closes gh-35127
2025-06-29 17:42:22 +02:00
Juergen Hoeller bd72f1fefc Fix inconsistencies in StaticListableBeanFactory
Closes gh-35119
2025-06-27 12:28:52 +02:00
Juergen Hoeller 511739e3de Add missing test for IllegalArgumentException
See gh-35111
2025-06-25 22:35:26 +02:00
Juergen Hoeller 61474cc34c Upgrade to Checkstyle 10.26 2025-06-25 19:00:45 +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
rstoyanchev f84552a97e Polishing contribution
Closes gh-35102
2025-06-25 12:37:42 +01:00
Daniil Razorenov 8d6117e419 Support StreamingHttpOutputMessage in RestClient
This commit allows RestClient to handle StreamingHttpOutputMessage
properly by checking the type of the request and invoking setBody()
when appropriate. This improves interoperability with components that
expect streamed output.

A new integration test has been added to verify the functionality.

See gh-35102

Signed-off-by: Daniil Razorenov <daniltmb@gmail.com>
2025-06-25 12:36:32 +01: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
Juergen Hoeller b6aa6899a8 Polishing 2025-06-24 21:58:39 +02:00
Juergen Hoeller 4190209ead Add missing AOT support for method overrides (including @Lookup)
Closes gh-34642
2025-06-24 21:58:31 +02:00
Sam Brannen cdf4c61d08 Upgrade to JUnit 5.13.2
Closes gh-35103
2025-06-24 16:12:39 +02:00
Juergen Hoeller aa525cc3cd Delegate to ReflectionUtils.accessibleConstructor 2025-06-18 12:20:30 +02:00
Juergen Hoeller 00399dc1b3 Reject null for returned CompletableFuture (avoiding subsequent NPE)
See gh-34708
2025-06-18 12:20:19 +02:00
Juergen Hoeller e33adadc62 Detect SQL state 57014 as QueryTimeoutException
Closes gh-35073
2025-06-18 12:20:09 +02:00
Brian Clozel 45d887f973 Fix missing request body for GET and DELETE JdkClientHttpRequest
This commit fixes a regression introduced in gh-34971 where GET and
DELETE requests would not allow request bodies anymore for
`JdkClientHttpRequest`.
We are now using `builder.GET()` and `builder.DELETE()` methods only if
the provided body is null.

Fixes gh-35068
2025-06-17 17:19:21 +02:00
Sam Brannen 103a7e58bb Apply consistent copyright headers in Kotlin source code
See gh-35070
2025-06-17 15:54:58 +02:00
Spring Builds aee29b7f30 Update copyright headers in source files
This commit updates Java, Kotlin, and Groovy source files to use the
"<year>-present" pattern in copyright headers.

Closes gh-35070
2025-06-17 15:54:58 +02:00
Sam Brannen 89140789b9 Update configuration for copyright headers to use "<year>-present" pattern
Historically, we have used `<introduction year>-<modification year>` as
the pattern for copyright headers.

For example: `Copyright 2002-2025 the original author or authors.`

However, we have been encouraged to use `present` as the modification
year.

In light of that, this commit updates the following to enforce the new
pattern.

- The patterns in our SpringHeaderCheck Checkstyle rules
- The `Copyright 2002-${year}` template in org.eclipse.jdt.ui.prefs
- The update_copyright_headers.sh script

See gh-35070
2025-06-17 15:54:36 +02:00
Brian Clozel 696692f1ed Do not attempt to decode wildcard content-types as form-data
Prior to this commit, the `DefaultServerWebExchange` would attempt to
decode request bodies as form-data or multipart of the request
content-type was compatible with the expected media types.

If requests are sent with an invalid wildcard content-type such as "*/*"
or "multipart/*", we should not attempt to decode here.

Fixes gh-34660
2025-06-16 15:51:47 +02:00
Brian Clozel faada70d59 Reset respone content-type for invalid range responses
Prior to this commit, the `ResourceHttpRequestHandler` would detect
invalid range requests and reply with a 416 response status and the
relevant range header. Because this was triggering an error dispatch,
the error handling would collect error metadata and produce an error
response with the original content-type.
This would most likely fail because the content-type is most likely a
file-related media type which cannot be used for error responses.

This commit resets the response content type in these cases and let the
error handling pick the most sensible media type for the error response.

Fixes gh- 34490
2025-06-15 18:42:45 +02:00
Sam Brannen 9f1aef16f9 Fix Javadoc for FixedBackOff 2025-06-14 15:33:04 +02:00
Brian Clozel 8dee7d8fb6 Use concrete form-data type when reading request body
Prior to this commit, the WebFlux server support would try reading
form-data from the request by:

* first, checking that request content-type is compatible with a
  form-data content-type
* then by selecting a message reader that is compatible with the given
  request content-type

This approach is flawed because if the content-type provided by the
request is too broad, another message reader could be selected that's
not meant to be used for reading form-data. Typically, a JSON message
reader could be selected and would fail when reading the request.
This problem was previously hidden because message readers would not
support `MultiValueMap` as a target type. Now that some readers support
this type, this can lead to deserialization errors.

This commit now ensures that in all cases, we attempt to read form-data
with a message reader that supports the
"application/x-www-form-urlencoded" media type.

Fixes gh-34660
2025-06-13 16:45:46 +02:00
Johnny Lim 722333f0f1 Polish DataBufferInputStream.skip()
See gh-34799
Closes gh-35030

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-06-13 09:57:02 +02:00
Brian Clozel 26ae3ed8d4 Upgrade "setup-gradle" GitHub action 2025-06-13 09:29:14 +02:00
Sébastien Deleuze e425504eac Revert "Disable Gradle auto-provisioning" on 6.2.x
This reverts commit 40058ef875.

Closes gh-35041
2025-06-12 16:37:59 +02:00
Brian Clozel 08d5af3d2a Next development version (v6.2.9-SNAPSHOT) 2025-06-12 11:44:16 +02:00
Brian Clozel f0e7b42704 Encode non-printable character in Content-Disposition parameter
Prior to this commit, the "filename" parameter value for the
"Content-Disposition" header would contain non-printable characters,
causing parsing issues for HTTP clients.
This commit ensures that all non-printable characters are encoded.

Fixes gh-35034
2025-06-12 08:39:29 +02:00
Johnny Lim e86dc9ad95 Apply gh-34856 to MockClientHttpRequest in testfixture package
Closes gh-35031

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-06-11 17:40:54 +02:00
Sébastien Deleuze 05c3f56ec7 Rely on default retention in @Contract
Closes gh-35027
2025-06-11 10:14:59 +02:00
Brian Clozel dee80ab1da Upgrade to Reactor 2024.0.7
Closes gh-35021
2025-06-11 09:23:17 +02:00
Brian Clozel 07fd835ea9 Upgrade to Micrometer 1.14.8
Closes gh-35020
2025-06-11 09:22:50 +02:00
Brian Clozel 0d6c6eb2d5 Use Micrometer BOM for Context Propagation dependency
Closes gh-35026
2025-06-11 09:15:30 +02:00
Sam Brannen 4d2cc4ae97 Polish contribution
See gh-35013
2025-06-10 11:45:20 +02:00
Mohammad Saeed Nouri c04902fefb Allow update of existing WebSession after max sessions limit is reached
Previously, when saving a WebSession, the system did not check whether
the session ID already existed. As a result, even if the session being
saved was an update to an existing one, it was incorrectly treated as a
new session, and a "maximum sessions exceeded" error was triggered.

This fix ensures that if a WebSession with the same ID already exists,
it will be updated rather than counted as a new session, thereby
preventing unnecessary session limit violations.

Closes gh-35013

Signed-off-by: Mohammad Saeed Nouri <msnsaeed71@gmail.com>
2025-06-10 11:44:59 +02:00
Sam Brannen 3c265e1044 Fix InMemoryWebSessionStoreTests.startsSessionImplicitly() test 2025-06-10 11:44:00 +02:00
Sam Brannen 222702f750 Polish WebSession support and tests 2025-06-10 11:43:56 +02:00
Sébastien Deleuze 7bb19fcde8 Refine Kotlin Serialization hint registration
This commit adds support for serializer methods with a parameter.

Closes gh-34979
2025-06-09 16:48:15 +02:00
Sam Brannen 18d6a55e3e Polishing and removal of "this." for method invocations 2025-06-09 14:10:30 +02:00
秦利斌 99890b6147 Fix ResourceHttpRequestHandler#setHeaders JavaDoc
Closes gh-35004
Signed-off-by: 秦利斌 <68638598+Allan-QLB@users.noreply.github.com>
2025-06-09 10:55:21 +02:00
Sam Brannen 0afdb08099 Upgrade to JUnit 5.13.1
Closes gh-34969
2025-06-07 12:03:10 +02:00
Sébastien Deleuze 40058ef875 Disable Gradle auto-provisioning
Closes gh-35007
2025-06-06 18:18:52 +02: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
Vedran Pavic 4d862b871d Improve Javadoc for @ExceptionHandler
This commit adds `ProblemDetail` and `ErrorResponse` to the list of
supported return types for `@ExceptionHandler` methods.

Closes gh-34554

Signed-off-by: Vedran Pavic <vedran@vedranpavic.com>
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
Sam Brannen 88cd7addda Upgrade to Gradle 8.14.2
Closes gh-34937
2025-06-06 15:06:06 +02:00
Brian Clozel 332c7f770c Remove Link to AspectJ Javadoc
Closes gh-35000
2025-06-06 12:05:44 +02:00
Juergen Hoeller 9f76ea13e3 Upgrade to Groovy 4.0.27, Mockito 5.18, Checkstyle 10.25 2025-06-06 09:21:37 +02:00
Juergen Hoeller d9c103b7ff Remove unnecessary fallback to DefaultConversionService
See gh-34936
2025-06-06 09:21:21 +02:00
Juergen Hoeller f1ddd051a3 Restore synchronization against AspectJ race condition behind PointcutExpression
Closes gh-34735
2025-06-05 20:36:10 +02:00
Juergen Hoeller a266e1b403 Close JarFile only in case of useCaches=false
Closes gh-34955
2025-06-05 20:20:47 +02:00
Sébastien Deleuze 4d09eb569b Refine RequestResponseBodyMethodProcessorKotlinTests
Improve read tests and fix copyright.

See gh-34992
2025-06-05 14:07:27 +02:00
Sébastien Deleuze a439e9030f Fix collection support in AbstractKotlinSerializationHttpMessageConverter
AbstractKotlinSerializationHttpMessageConverter#getSupportedMediaTypes(Class<?>)
currently invokes transitively supports(Class<?>) which always return false
with generic types.

This commit adds an override that just invokes getSupportedMediaTypes().

Closes gh-34992
2025-06-05 12:02:22 +02:00
James Yuzawa aa5c0dcd72 Add caching headers to unmodified static resources
per https://www.rfc-editor.org/rfc/rfc7232#section-4.1

The server generating a 304 response MUST generate any of the
following header fields that would have been sent in a 200 (OK)
response to the same request: Cache-Control, Content-Location, Date,
ETag, Expires, and Vary.

Closes gh-34614

Signed-off-by: James Yuzawa <jtyuzawa@gmail.com>
2025-06-05 10:58:24 +02:00
Brian Clozel 4a46d957f3 Fix out of bounds exception for PathPattern#combine
Prior to this commit, combining the "/*" and  "/x/y" path patterns
would result in a `StringIndexOutOfBoundsException`.

This commit fixes this problem and revisits the implementation for
better consistency:

* "/*" + "/x/y" is now "/x/y"
* "/x/*.html" + "/y/file.*" is now rejected because they don't share the
  same prefix.

This change also adds the relevant Javadoc to the `PathPattern#combine`
method.

Fixes gh-34986
2025-06-04 20:18:33 +02:00
Sam Brannen 4df93a825b Update copyright headers and fix test method name 2025-06-04 11:28:55 +02:00
rstoyanchev be17315f63 Add mention of CompletionStage in "Async Requests"
Closes gh-34991
2025-06-03 19:10:03 +01:00
DongNyoung Lee 31903a9d92 Fix typo in MockClientHttpRequest Javadoc
Closes gh-34856

Signed-off-by: DongNyoung Lee <121621378+Dongnyoung@users.noreply.github.com>
2025-06-03 19:05:32 +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
Tran Ngoc Nhan 3f0892b42c Fix typos
Closes gh-34876

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-06-03 18:55:15 +01:00
Patrick Strawderman 182d654fa8 Add optimized DataBufferInputStream overrides
Add optimized DataBufferInputStream overrides for readNBytes, skip, and transferTo; all of them
allocate byte buffers which we can either avoid (in the case of skip) or size more precisely since
the number of remaining bytes is known.

Closes gh-34799

Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>
2025-06-03 18:06:43 +02:00
Johnny Lim bbae625850 Add Javadoc since for gh-34745
Closes gh-34940

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-06-03 18:06:24 +02:00
Sam Brannen f376d1b525 Remove @⁠Contract declaration for CodeFlow.isIntegerForNumericOp()
Since the Number parameter is not @⁠Nullable, the @⁠Contract declaration
is unnecessary.

Closes gh-34985
2025-06-03 12:58:45 +02:00
Sam Brannen 707b7698ce Consistent @⁠Contract expression formatting 2025-06-02 17:00:28 +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
Brian Clozel 659472f9e3 Use HTTP methods in JdkClientHttpRequest when possible
Prior to this commit, we would use the
`java.net.http.HttpRequest.Builder#method(String, BodyPublisher)` to
create HTTP requests for the JDK HttpClient. This method requires a
non-null body publisher; providing an empty publisher writes a
"Content-Length: 0" header to all requests.

As of Java 19, this behavior changes for `HttpRequest.Builder#GET` and
similar methods, where the body publisher is considered as null and no
"Content-Length" header is written.

This commit aligns with this behavior and favors dedicated HTTP methods
whenever available.`

Closes gh-34971
2025-06-02 15:36:20 +02:00
Dmytro Nosan c2d678879f Fix AOT code generation for autowired inner class constructor
Prior to this commit, argument index handling in
AutowiredArgumentsCodeGenerator suffered from an off-by-one error when
generating code for an autowired inner class constructor.

Since the startIndex is already properly calculated for an inner class in
InstanceSupplierCodeGenerator.buildGetInstanceMethodForConstructor(...),
there is no need to adjust the argument indexes within
AutowiredArgumentsCodeGenerator.generateCode(...).

Closes gh-34974

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
2025-06-02 10:43:21 +02:00
Sam Brannen f207c0ed5c Polish contribution
See gh-34949
2025-06-02 10:10:46 +02:00
Mengqi Xu bbf61c74ab Fix REPLY_CHANNEL header check in MessageHeaderAccessor
Prior to this commit, the verifyType() method in MessageHeaderAccessor
checked if REPLY_CHANNEL ended with the given header name which does
not make much sense and is inconsistent with the ERROR_CHANNEL check.

This commit therefore checks if the REPLY_CHANNEL is equal to the given
header name, analogous to the ERROR_CHANNEL check.

See gh-34881
Closes gh-34949

Signed-off-by: Mengqi Xu <2663479778@qq.com>
2025-06-02 10:00:01 +02:00
Aurh1l aea66265f7 Fix syntax in @⁠SqlGroup example
Closes gh-34972
2025-05-31 12:15:50 +02:00
Sam Brannen 016294b067 Avoid overriding methods deprecated in JUnit Jupiter 5.13
See gh-34969
2025-05-30 14:54:57 +02:00
Sam Brannen 8201193650 Upgrade to JUnit 5.13
Closes gh-34969
2025-05-30 13:57:18 +02:00
Dhruv 562157d2c0 Update X-Forwarded-Proto doc to say "https / http"
Closes gh-34959

Signed-off-by: Dhruv <dhruv2015@hotmail.co.uk>
2025-05-28 16:41:16 +02:00
Dmitry Sulman 63db3d06ab Fix method links in Javadoc of WebClient
Closes gh-34938

Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
2025-05-28 11:05:00 +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
rstoyanchev 983af78352 Configurable limit on HandlerMappingIntrospector
Closes gh-34918
2025-05-28 11:05:00 +01:00
Sébastien Deleuze 67ed64a41d Remove not null checks in BeanUtilsKotlinTests 2025-05-28 10:31:07 +02:00
Sébastien Deleuze d777b70889 Ignore DefaultConstructorMarker in BeanUtils#getParameterNames
Closes gh-34760
2025-05-28 10:12:09 +02:00
Sam Brannen 472c4012ca Remove obsolete note from Javadoc for BeanDefinitionReader 2025-05-27 11:32:05 +02:00
Sam Brannen 90be94a4a5 Use ConversionService from Environment in PropertySourcesPlaceholderConfigurer
This commit fixes a regression in PropertySourcesPlaceholderConfigurer
that was introduced in Spring Framework 6.2.7.

Specifically, this commit reinstates automatic String-conversion of
values from PropertySources in the Environment using the
ConversionService configured in the Environment.

See gh-34861
Closes gh-34936
2025-05-27 11:20:09 +02:00
Juergen Hoeller d9e261aecd Enforce backwards compatibility for null bean in shortcut code path
Closes gh-34929
2025-05-27 09:47:39 +02:00
Juergen Hoeller 15d1455acb Check for package-visible constructor in case of ClassLoader mismatch
Closes gh-34950
2025-05-27 09:47:29 +02:00
Sam Brannen 53844b068c Test conversion support in PropertySourcesPlaceholderConfigurer
This commit introduces a @⁠Disabled "regression test" which demonstrates
that PropertySourcesPlaceholderConfigurer uses the ConversionService
from the Environment.

See gh-34936
2025-05-26 18:18:52 +02:00
Sam Brannen d78264756e Support only Object property values in MockEnvironment test fixture
The setProperty() and withProperty() methods in MockEnvironment were
originally introduced with (String, String) signatures; however, they
should have always had (String, Object) signatures in order to comply
with the MockPropertySource and PropertySource APIs.

To address that, this commit changes the signatures of these methods so
that they only accept Object values for properties.

NOTE: this commit only affects the internal MockEnvironment used as a
test fixture. This commit does not affect the official, public
MockEnvironment implementation in spring-test.

See gh-34947
See gh-34948
2025-05-26 17:29:16 +02:00
Sam Brannen d0efc2230c Support Object property values in MockEnvironment
The setProperty() and withProperty() methods in MockEnvironment were
originally introduced with (String, String) signatures; however, they
should have always had (String, Object) signatures in order to comply
with the MockPropertySource and PropertySource APIs.

To address that, this commit introduces variants of these methods that
accept Object values for properties.

Closes gh-34947
2025-05-26 17:22:52 +02:00
Sam Brannen 6a6abac003 Polish Javadoc for MockPropertySource 2025-05-26 17:21:31 +02:00
Sébastien Deleuze 66f8eb02bd Upgrade to HttpComponents HttpClient 5.5
Closes gh-34941
2025-05-26 10:25:00 +02:00
Sam Brannen 274b97ca14 Upgrade to Gradle 8.14.1
Closes gh-34937
2025-05-23 17:32:53 +02:00
Sam Brannen e4b4512bcb Update code due to change in nullability contract
See gh-34933
2025-05-22 17:43:38 +02:00
Sam Brannen db5809f968 Remove obsolete @⁠Contract declaration for StreamUtils.drain()
Closes gh-34933
2025-05-22 17:23:35 +02:00
Sam Brannen d890a38f3c Support registration of non-public BeanDefinitionReader via @⁠ImportResource
Prior to this commit, a BeanDefinitionReader registered via
@⁠ImportResource was required to be public and have a public
constructor that accepts a single BeanDefinitionRegistry. However, the
public visibility requirements are not necessary, and the requirements
for the constructor's formal parameter list is not documented.

To address those issues, this commit removes the public visibility
restrictions and documents that a BeanDefinitionReader registered via
@⁠ImportResource must declare a constructor that accepts a single
BeanDefinitionRegistry.

In addition, this commit includes the cause of the instantiation
failure in case the registered BeanDefinitionReader cannot be
instantiated.

Closes gh-34928
2025-05-21 15:37:04 +02:00
Sam Brannen 98cef503fb Remove obsolete TODO
See gh-10976
2025-05-21 15:37:04 +02:00
Sam Brannen 362fe12704 Polishing 2025-05-21 15:36:58 +02:00
Brian Clozel 2af0323c21 Use Content-Type charset in JAXB message converters
Prior to this commit, the JAXB message converters would only rely on the
encoding declaration inside the XML document for reading the document.
This would then use the default UTF-8 encoding, even if the HTTP message
has the `"application/xml;charset=iso-8859-1"` Content-Type.

This commit ensures that both `Jaxb2CollectionHttpMessageConverter` and
`Jaxb2RootElementHttpMessageConverter` use the encoding declared in the
HTTP Content-Type, if present.

Fixes gh-34745
2025-05-19 16:57:57 +02:00
Brian Clozel fdab8fabd2 Avoid duplicate Content-Type in MockHttpServletRequest
Fixes gh-34913
2025-05-19 12:04:46 +02:00
Brian Clozel ae8b45a290 Next development version (v6.2.8-SNAPSHOT) 2025-05-15 11:07:25 +02:00
rstoyanchev ee62701f56 Make use of PatternMatchUtils ignoreCase option
Closes gh-34801
2025-05-15 08:18:56 +01:00
Juergen Hoeller fa168ca78a Revise FactoryBean locking behavior for strict/lenient consistency
After the bootstrap phase (and with spring.locking.strict=true during the bootstrap phase), getSingletonFactoryBeanForTypeCheck always locks. In a background bootstrap thread, it never locks. Otherwise, it tries locking and explicitly resolves the bean class for subsequent type-based resolution (even for a component-scanned class) when it fails to acquire the lock. Furthermore, getObjectFromFactoryBean follows the same locking algorithm for post-processing.

Closes gh-34902
2025-05-15 01:45:09 +02:00
rstoyanchev 3c228a5c1d Add missing @since tags in PatternMatchUtils
See: gh-34801
2025-05-14 15:15:50 +01:00
Juergen Hoeller 9bf6b8cddf Upgrade to Reactor 2024.0.6
Closes gh-34898
2025-05-14 15:03:28 +02:00
Patrick Strawderman 37ecdd1437 Forward more methods to underlying InputStream in NonClosingInputStream
NonClosingInputStream extends FilterInputStream, which does not forward some
newer InputStream methods such as transferTo and readAllBytes. Specific InputStream
implementations may have more optimized methods (e.g., FileInputStream).

Closes gh-34893

Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>
2025-05-14 09:58:23 +02:00
Juergen Hoeller 73f1c5a189 Polishing 2025-05-13 16:08:57 +02:00
Juergen Hoeller 4d296fb4ca Upgrade to Micrometer 1.14.7
Includes Jackson 2.18.4, Jetty 12.0.21, Netty 4.1.121, Apache HttpClient 5.4.4, Checkstyle 10.23.1

Closes gh-34889
2025-05-13 16:08:31 +02:00
Juergen Hoeller 6a9444473f Clarify CompositePropertySource behavior for EnumerablePropertySource contract
Closes gh-34886
2025-05-13 16:08:03 +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 e34cdc2a55 Improve Javadoc for property placeholder support 2025-05-12 17:25:49 +02:00
Sam Brannen 8b1b9ef9e5 Stop redefining placeholder syntax constants in PlaceholderConfigurerSupport 2025-05-12 17:21:37 +02:00
Sam Brannen efdaae02e0 Add test for late binding from Environment property sources
This new test serves as a "regression test" for behavior tested in
Spring Boot.

See gh-34861
2025-05-11 16:41:19 +02:00
Sam Brannen 49ffb833a3 Sort methods to align with PropertySource declaration order
See gh-34861
2025-05-11 15:48:00 +02:00
Sam Brannen 065e50a444 Override containsProperty() in FallbackEnvironmentPropertySource
This commit overrides containsProperty() in
FallbackEnvironmentPropertySource for consistency with the
implementation of ConfigurableEnvironmentPropertySource.

See gh-34861
2025-05-11 15:44:51 +02:00
Sam Brannen 7135527765 Always obtain fresh PropertySources in ConfigurableEnvironmentPropertySource
Although it's unlikely that the implementation of getPropertySources()
in a ConfigurableEnvironment would be overridden to return a different
MutablePropertySources instance than the one that the
ConfigurableEnvironment typically acts on, it is in fact possible.

In light of that possibility, this commit refactors
ConfigurableEnvironmentPropertySource so that it always obtains a fresh
PropertySources reference.

See gh-34861
2025-05-11 15:30:09 +02:00
Sam Brannen 65e30132f3 Revert "Introduce CompositePropertySource constructor that accepts Iterable<PropertySource>"
This reverts commit 0867dfca33.
2025-05-11 14:10:54 +02:00
Sam Brannen ebb44a8368 Restore support for non-EnumerablePropertySource in PropertySourcesPlaceholderConfigurer
Commit 3295289e17 fixed a number issues with placeholder resolution in
PropertySourcesPlaceholderConfigurer. However, in doing so, it replaced
a raw PropertySource with a CompositePropertySource which implements
EnumerablePropertySource.

Consequently, all property sources registered in the Environment must
now implement EnumerablePropertySource (which is not an actual
requirement). Otherwise, invocations of getPropertyNames() on the
CompositePropertySource result in an IllegalStateException, and that is
a breaking change which resulted in numerous build failures within the
Spring portfolio.

To address that regression, this commit introduces a private
ConfigurableEnvironmentPropertySource in
PropertySourcesPlaceholderConfigurer which is a "raw" PropertySource
that delegates directly to the PropertySources in a
ConfigurableEnvironment.

This commit also extracts the raw PropertySource for direct Environment
delegation into a new FallbackEnvironmentPropertySource.

See gh-17385
Closes gh-34861
2025-05-11 13:46:11 +02:00
Sam Brannen 3096bb6d0c Polishing 2025-05-11 13:24:40 +02:00
Sam Brannen 2b2a57b4a3 Polish Javadoc 2025-05-10 15:44:08 +02:00
Sam Brannen 3295289e17 Fix placeholder resolution in PropertySourcesPlaceholderConfigurer
Currently, the placeholder resolution algorithm in
PropertySourcesPlaceholderConfigurer fails in several scenarios, and
the root cause for this category of failures has actually existed since
PropertySourcesPlaceholderConfigurer was introduced in Spring Framework
3.1.

Specifically, PropertySourcesPlaceholderConfigurer creates its own
PropertySourcesPropertyResolver that indirectly delegates to another
"nested" PropertySourcesPropertyResolver to interact with
PropertySources from the Environment, which results in double
placeholder parsing and resolution attempts, and that behavior leads to
a whole category of bugs.

For example, #27947 was addressed in Spring Framework 5.3.16, and due
to #34315 and #34326 we have recently realized that additional bugs
exist with placeholder resolution: nested placeholder resolution can
fail when escape characters are used, and it is currently impossible
to disable the escape character support for nested resolution.

To address this category of bugs, we no longer indirectly use or
directly create a "nested" PropertySourcesPropertyResolver in
PropertySourcesPlaceholderConfigurer. Instead, properties from property
sources from the Environment are now accessed directly without
duplicate/nested placeholder resolution.

See gh-27947
See gh-34326
See gh-34862
Closes gh-34861
2025-05-10 15:14:50 +02:00
Sam Brannen 457e876303 Polish reference manual regarding placeholders 2025-05-10 15:10:29 +02:00
Sam Brannen 021bf6e77d Add more tests for escape character support in PlaceholderParser 2025-05-10 14:19:41 +02:00
Sam Brannen 90453643cc Simplify and revise PlaceholderParserTests for consistency 2025-05-10 14:16:49 +02:00
Sam Brannen 5a2cbc1ab3 Polish PropertySourcesPropertyResolverTests 2025-05-09 16:43:04 +02:00
Sam Brannen 348b4cd067 Polish contribution
See gh-34720
2025-05-09 16:32:13 +02:00
Fawzi Essam 9b52cfd7d5 Test escape character support in PropertySourcesPropertyResolver
See gh-34326
See gh-34720
See gh-34861

Signed-off-by: Fawzi Essam <iifawzie@gmail.com>
2025-05-09 16:31:27 +02:00
Sam Brannen dd6eede243 Properly expand reused collection parameters in R2DBC NamedParameterUtils
Prior to this commit, NamedParameterUtils in spring-r2dbc did not
properly expand reused collection parameters. Specifically, values in a
supplied collection were only expanded in the resulting query once, for
the first occurrence of the named parameter.

To address that, this commit effectively reinstates the original logic
for ExpandedQuery from NamedParameterUtils in the Spring Data R2DBC
project.

https://github.com/spring-projects/spring-data-relational/blob/94958f5eb66cbe2e8e025155cd99abf36f6f91f4/spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/core/NamedParameterUtils.java#L486

Closes gh-34768
2025-05-09 14:27:19 +02:00
Sam Brannen de97e35189 Polish Javadoc and internals of R2DBC support 2025-05-09 14:04:10 +02:00
Sam Brannen 45a2c51fe1 Polish Javadoc for Environment-related components 2025-05-08 10:49:44 +02:00
Sam Brannen b98c3257af Introduce @⁠Disabled failing test for R2DBC NamedParameterUtils
The last assertion of the new test method currently fails since "foo"
is only bound once.

java.lang.AssertionError:
Expected size: 2 but was: 1 in:
{0="foo"}

See gh-34768
2025-05-07 17:30:07 +02:00
Sam Brannen ea8ae09cb7 Revise NamedParameterUtilsTests for consistency 2025-05-07 17:24:41 +02:00
Sam Brannen 0abfad870c Polish class-level Javadoc for SpringProperties 2025-05-07 16:14:23 +02:00
Sam Brannen 5a9af9e024 Document AotDetector.AOT_ENABLED flag in SpringProperties
Prior to this commit, the AotDetector.AOT_ENABLED flag was documented
in the reference manual not in the Javadoc for SpringProperties.
2025-05-07 16:14:07 +02:00
Sam Brannen 0867dfca33 Introduce CompositePropertySource constructor that accepts Iterable<PropertySource>
This commit introduces a new constructor for CompositePropertySource
that accepts a `String name` and an Iterable<PropertySource<?>>, which
allows a CompositePropertySource to be constructed from existing
property sources, such as an instance of MutablePropertySources.

Closes gh-34862
2025-05-07 14:25:13 +02:00
Sam Brannen b4355dc955 Polishing 2025-05-07 12:42:40 +02:00
Sam Brannen bc91e0ea96 Revise PropertyResolver Javadoc to highlight resolution semantics 2025-05-06 18:50:33 +02:00
Sam Brannen 8599ee6c2b Polish Javadoc 2025-05-06 16:07:46 +02:00
Sam Brannen bc466022b1 Fix typo in parameter name 2025-05-06 16:07:46 +02:00
Brian Clozel 6f11711e27 Fix HttpClient 5.3.x request config compatibility
As of gh-33806, the HttpComponents client request factory is forward
compatible with the 5.4+ versions of that library for configuring HTTP
request configuration.

This change would not tkae into account configuration set at the Spring
level because it would consider the default `RequestConfig` instance as
a custom one. This commit ensures that Spring sets its own configuration
if no custom configuration was set for all supported HttpComponents
generations.

Fixes gh-34851
2025-05-05 14:38:30 +02:00
rstoyanchev c067919173 Ensure Fragment can merge attributes
Use a new map when merging as the original may be immutable.

Closes gh-34848
2025-05-02 15:58:51 +01:00
rstoyanchev ac773d97e9 Polishing contribution
Closes gh-34828
2025-05-02 15:58:51 +01:00
Artur bd7007227c Provide a working example instead of unclear placeholders
See gh-34828

Signed-off-by: Artur <artur@vaadin.com>
2025-05-02 15:58:51 +01:00
Sam Brannen e8f873a349 Ensure Bean Overrides are discovered once in hierarchies
Prior to this commit, bean overrides (such as @⁠MockitoBean, etc.) were
discovered multiple times if they were declared:

- at the type-level on an interface that is implemented at more than
  one level in the type hierarchy, the enclosing class hierarchy, or a
  combination of the type and enclosing class hierarchies.

or

- on a field declared in a class which can be reached multiple times
  while traversing the type and enclosing class hierarchies in
  scenarios such as the following: the class (X) in which the field is
  declared is a supertype of an enclosing type of the test class, and X
  is also an enclosing type of a supertype of the test class.

Such scenarios resulted in an IllegalStateException stating that a
duplicate BeanOverrideHandler was discovered.

To address that, this commit revises the search algorithm in
BeanOverrideHandler so that all types (superclasses, enclosing classes,
and implemented interfaces) are only visited once while traversing the
type and enclosing class hierarchies in search of bean override
handlers.

See gh-33925
See gh-34324
Closes gh-34844
2025-05-02 11:26:33 +02:00
Sam Brannen b943817f3e Close ApplicationContext after test AOT processing
See commit 1c108054ee
Closes gh-34841
2025-05-01 10:50:38 +02:00
Juergen Hoeller 4466548f53 Align parameter javadoc with nullable signature
Closes gh-34845
2025-04-30 17:55:39 +02:00
Juergen Hoeller 9c183f9e77 Add explicit note on redeclaring in each application context
Closes gh-34843
2025-04-30 17:55:18 +02:00
Juergen Hoeller 03620fc530 Polishing 2025-04-29 11:47:47 +02:00
Juergen Hoeller 1c108054ee Close ApplicationContext after AOT processing
Closes gh-34841
2025-04-29 11:47:09 +02:00
Juergen Hoeller d0b186a1c7 Polishing 2025-04-28 16:13:04 +02:00
Juergen Hoeller 4172581f1b Try loadClass on LinkageError in case of same ClassLoader as well
Closes gh-34824
2025-04-28 16:12:45 +02:00
rstoyanchev c88ba6c90e Polishing contribution
Closes gh-34812
2025-04-28 14:23:30 +01:00
Yanming Zhou d7c13d6518 HttpEntity.EMPTY should be immutable
See gh-34812

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-04-28 14:22:59 +01:00
Sam Brannen 5013d6d771 Fail Gradle build whenever a javadoc task fails
To ensure that failures in javadoc tasks do not result in documentation
silently not being generated/published, this commit sets
`failOnError = true` for all javadoc tasks.

See gh-27497
See gh-34774
Closes gh-34837
2025-04-27 17:59:41 +02:00
Sam Brannen 9cd7b6a91e Upgrade spring-javaformat-gradle-plugin to version 0.0.43 2025-04-27 16:51:47 +02:00
Sam Brannen e9dcd64068 Upgrade to Gradle 8.14
Closes gh-34836
2025-04-27 16:29:46 +02:00
Sam Brannen ce7f47c962 Upgrade io.freefair.aggregate-javadoc plugin to version 8.13.1 2025-04-27 16:23:22 +02:00
Sam Brannen ef34464c94 Restructure TestContext framework support sections
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 ef11a00c0b Polishing 2025-04-26 09:37:34 +02:00
Sam Brannen 176b0b09bf Migrate remaining JUnit 4 tests to JUnit Jupiter where feasible
In 49e5c84928 I unfortunately overlooked
several JUnit 4 based tests in the `junit4` package that should be
migrated to JUnit Jupiter.

This commit address those remaining test classes.

See gh-23451
See gh-34794
Closes gh-34813
2025-04-26 07:51:24 +02:00
rstoyanchev c48ff357dc HTTP Service proxy sets body type
Closes gh-34793
2025-04-25 21:03:00 +01:00
rstoyanchev 190dabb8e1 Polishing contribution
Closes gh-34789
2025-04-25 21:03:00 +01:00
blake_bauman d15abd58b4 Add option to set Principal in MockServerWebExchange
See gh-34789

Signed-off-by: blake_bauman <blake_bauman@apple.com>
2025-04-25 21:03:00 +01:00
Sam Brannen 44500cf868 Revise TestConventions to retain existing JUnit Platform options
This commit revises the implementation of TestConventions so that
existing JUnit Platform options from a pre-configured `test` task are
copied instead of overridden.

Closes gh-34827
2025-04-25 13:38:18 +02:00
Sam Brannen e384389790 Reinstate the @⁠Inject Technology Compatibility Kit (TCK)
In commit 05ebca8677, the `public` modifier was removed from the
SpringAtInjectTckTests class, which prevents it from being run as a
JUnit 3 test class.

To address that, this commit adds the missing `public` modifier as well
as a a code comment to help prevent this from happening again.

In addition, this commit updates spring-context.gradle to ensure that
the JUnit Vintage test engine is always applied. However, that Gradle
configuration is unfortunately ignored due to how our TestConventions
class has been implemented. Thus, that issue will have to be addressed
separately.

Closes gh-34800
2025-04-25 12:08:39 +02:00
Sam Brannen 49e5c84928 Migrate remaining JUnit 4 tests to JUnit Jupiter where feasible
In Spring Framework 5.2, we migrated most of the test suite from JUnit
4 to JUnit Jupiter; however, prior to this commit, several tests in the
spring-test module were still based on JUnit 4 unnecessarily.

Since we are now planning to deprecate our JUnit 4 support in 7.0, this
commit migrates our remaining JUnit 4 based tests to JUnit Jupiter
whenever feasible. In the process, test classes that previously resided
under the "junit4" package have been moved to new packages directly
under the "org.springframework.text.context" package, and several
classes have been renamed for greater clarity of purpose.

Consequently, the only remaining tests based on JUnit 4 are those tests
that are required to run with JUnit 4 in order to test our JUnit 4
support.

This commit also greatly simplifies exclusions for Checkstyle rules
pertaining to JUnit usage.

See gh-23451
See gh-34794
Closes gh-34813
2025-04-24 16:20:39 +02:00
Sébastien Deleuze 56eb135608 Fix AbstractJackson2HttpMessageConverter nullness
This commit makes AbstractJackson2HttpMessageConverter#getObjectMappersForType
return value non nullable as an empty map is returned in case of no
registrations.

Closes gh-34811
2025-04-24 10:37:30 +02:00
rstoyanchev 5c5cf73e11 Add ignoreCase variants to PatternMatchUtils
See gh-34801
2025-04-23 12:10:55 +01:00
rstoyanchev 858c2bd270 Polishing contribution
Closes gh-34783
2025-04-23 10:54:52 +01:00
whl 124582d910 Fix expansion of query param with same name
See gh-34783

Signed-off-by: whl <whlit.cola@gmail.com>
2025-04-23 10:54:52 +01:00
Juergen Hoeller 253f321e8b Early getJarFile() call for consistent jar file existence check
See gh-34796
2025-04-23 10:16:12 +02:00
Juergen Hoeller 0252e39409 Check for the existence of any actual jar entries in case of jar root
Closes gh-34796
2025-04-22 23:18:56 +02:00
Sam Brannen 2f60083cd5 Add integration tests for reused named parameters from bean properties
See gh-34768
2025-04-22 12:45:35 +02:00
Juergen Hoeller b83e07ff8c Ignore NoSuchFileException from getJarFile() as well
Closes gh-34764
2025-04-22 12:17:18 +02:00
Juergen Hoeller 1841ad3472 Consistently use local copy of volatile mainThreadPrefix field
Closes gh-34746
2025-04-22 12:17:03 +02:00
Sam Brannen 0477ba4de4 Remove obsolete RmiInvocationWrapperRTD.xml file
Closes gh-34779

(cherry picked from commit e7402bc365)
2025-04-22 12:10:18 +02:00
Sam Brannen 8c376e9cc5 Remove redundant parameter count check in AnnotationsScanner.hasSameParameterTypes()
The redundancy was reported by @TAKETODAY.

See gh-34717
2025-04-22 11:53:40 +02:00
Sam Brannen 018d3c9ef2 Add integration tests for reused named parameters
See gh-34768
2025-04-17 15:48:24 +02:00
Brian Clozel c70741f60d Next development version (v6.2.7-SNAPSHOT) 2025-04-17 09:50:20 +02:00
Sam Brannen f40d98668d Revise configuration for javadoc Gradle tasks
Closes gh-34766
2025-04-16 13:42:05 +02:00
rstoyanchev 9c13c6b695 Revert "Use optimistic locking where possible in ResponseBodyEmitter"
This reverts commit e67f892e44.

Closes gh-34762
2025-04-16 11:53:22 +01:00
rstoyanchev b49924ba37 Revert "Fix handling of timeout in SseEmitter"
This reverts commit f92f9c1d5b.

See gh-34762
2025-04-16 11:41:00 +01:00
Stéphane Nicoll 7b8c104077 Upgrade to github-changelog-generator 0.0.12
Closes gh-34755
2025-04-15 10:04:45 +02:00
Sam Brannen 8f62a8f579 Suppress recently introduced warning 2025-04-14 14:25:48 +02:00
Sam Brannen d0966dfb58 Revise contribution
See gh-34747
2025-04-14 14:15:50 +02:00
lituizi bb45a3ae69 Update AbstractAutowireCapableBeanFactory.ignoreDependencyInterface() Javadoc
Specifically, the documentation update reflects that:

- Initially, it was mentioned that only the `BeanFactoryAware`
  interface is ignored by default.

- The updated documentation now correctly states that `BeanNameAware`,
  `BeanFactoryAware`, and `BeanClassLoaderAware` interfaces are all
  ignored by default.

This change ensures a more accurate representation of the default
behavior regarding which dependency interfaces are automatically
ignored during autowiring in the context of Spring's bean factory
mechanism.

Closes gh-34747

Signed-off-by: lituizi <2811328244@qq.com>
2025-04-14 14:07:35 +02:00
Sam Brannen 7095f4cb66 Use proper casing for parameter and variable names 2025-04-14 11:25:40 +02:00
Sam Brannen a22d204681 Remove duplicate words in Java source code
Discovered using regular expression: \b(\w+)\s+\1\b[^(}]
2025-04-14 11:24:55 +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
Juergen Hoeller c4f66b776f Use single volatile field for indicating pre-instantiation phase
See gh-34729
2025-04-12 06:00:18 +02:00
Sam Brannen 87e04df983 Upgrade to JUnit 5.12.2 2025-04-11 16:58:23 +02:00
Sam Brannen 4d648f8b5d Clean up warnings in Gradle build 2025-04-11 16:57:57 +02:00
Juergen Hoeller 6ea9f66fd7 Remove superfluous DefaultParameterNameDiscoverer configuration 2025-04-10 18:33:39 +02:00
Juergen Hoeller eea6addd26 Avoid lenient locking for additional external bootstrap threads
Includes spring.locking.strict revision to differentiate between true, false, not set.
Includes checkFlag accessor on SpringProperties, also used in StatementCreatorUtils.

Closes gh-34729
See gh-34303
2025-04-10 18:33:21 +02:00
Juergen Hoeller 7f2c1f447f Try loadClass on LinkageError in case of ClassLoader mismatch
See gh-34677
2025-04-10 18:30:45 +02:00
Sam Brannen 26869b0e4c Polish Bean Override internals 2025-04-10 17:06:27 +02:00
Sam Brannen cd987fc104 Update Javadoc to stop mentioning 5.3.x as the status quo
Closes gh-34740
2025-04-10 16:40:04 +02:00
Sam Brannen 3f9402a56b Update testing documentation to reflect status quo 2025-04-10 15:06:52 +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
Juergen Hoeller 3afd551174 Add rejectTasksWhenLimitReached option for concurrency limit
Closes gh-34727
2025-04-07 23:54:05 +02:00
Juergen Hoeller ffd15155ee Upgrade to Mockito 5.17 and Checkstyle 10.23 2025-04-07 22:41:45 +02:00
Juergen Hoeller 74ab5e4e25 Enforce circular reference exception between more than two threads as well
See gh-34672
2025-04-07 22:37:19 +02:00
Juergen Hoeller 463541967a Enforce circular reference exception between all thread variations
Closes gh-34672
2025-04-07 17:08:47 +02:00
Sam Brannen 4510b78dfd Include @⁠ContextCustomizerFactories in @⁠NestedTestConfiguration Javadoc 2025-04-07 15:57:20 +02:00
Sam Brannen 63f4ba4b2a Move field injection logic to BeanOverrideTestExecutionListener
For bean override support (@⁠MockitoBean, @⁠TestBean, etc.), the logic
for field injection previously resided in the BeanOverrideRegistry
which resulted in a strange mixture of concerns.

To address that, this commit moves the field injection logic to the
BeanOverrideTestExecutionListener, and the BeanOverrideRegistry now
serves a single role, namely the role of a registry.

Closes gh-34726
2025-04-07 14:05:58 +02:00
Sam Brannen 0c7bc232d6 Redesign BeanOverrideRegistry internals 2025-04-07 13:42:11 +02:00
Sam Brannen 470bf3b0bb Add missing Javadoc for BeanOverrideHandler constructor 2025-04-06 18:18:07 +02:00
Sam Brannen 2ca9f6f064 Indent with tabs instead of spaces in Gradle build scripts 2025-04-06 17:39:23 +02:00
Johnny Lim ecd8cd797e Use implementation Gradle configuration for framework-docs module
Closes gh-34719

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-04-06 17:28:34 +02:00
Juergen Hoeller cc5ae23915 Suppress rollback attempt in case of timeout (connection closed)
Closes gh-34714
2025-04-05 16:03:31 +02:00
Sam Brannen dbd47ff4f9 Implement additional micro performance optimizations
See gh-34717
2025-04-04 15:51:37 +02:00
Sam Brannen 381bc4c405 Polish contribution
See gh-34717
2025-04-04 15:29:10 +02:00
Olivier Bourgain 0f2308e85f Implement micro performance optimizations
- ClassUtils.isAssignable(): Avoid Map lookup when the type is not a
  primitive.

- AnnotationsScanner: Perform low cost array length check before String
  comparisons.

- BeanFactoryUtils: Use char comparison instead of String comparison.
  The bean factory prefix is '&', so we can use a char comparison
  instead of more heavyweight String.startsWith("&").

- AbstractBeanFactory.getMergedBeanDefinition(): Perform the low cost
  check first. Map lookup, while cheap, is still more expensive than
  instanceof.

Closes gh-34717

Signed-off-by: Olivier Bourgain <olivierbourgain02@gmail.com>
2025-04-04 14:34:55 +02:00
Juergen Hoeller ee804ee8fb Avoid throwing of plain RuntimeException 2025-04-04 00:22:24 +02:00
Juergen Hoeller 4e5979c75a Consistent CacheErrorHandler processing for @Cacheable(sync=true)
Closes gh-34708
2025-04-04 00:22:12 +02:00
Juergen Hoeller e7db15b325 Perform type check before singleton check for early FactoryBean matching
Closes gh-34710
2025-04-03 11:59:22 +02:00
Sam Brannen 8f9cbcd86d Add @⁠since tags
See gh-34692
2025-04-03 10:33:19 +02:00
Juergen Hoeller 6bb964e2d0 Explicitly use original ClassLoader in case of package visibility
Closes gh-34684
2025-04-02 23:41:43 +02:00
Taeik Lim a946fe2bf8 Fix broken link for Server-Sent Events
Signed-off-by: Taeik Lim <sibera21@gmail.com>
Closes gh-34705
2025-04-02 17:43:42 +02:00
Sébastien Deleuze 671d972454 Add RestClient.RequestHeadersSpec#exchangeForRequiredValue
This commit adds a variant to RestClient.RequestHeadersSpec#exchange
suitable for functions returning non-null values.

Closes gh-34692
2025-04-02 17:10:01 +02:00
Sébastien Deleuze d9047d39e6 Refine ExchangeFunction Javadoc
See gh-34692
2025-04-02 17:10:01 +02:00
Sébastien Deleuze 4db12806d1 Revert "Add a requiredExchange extension to RestClient"
This reverts commit dcb9383ba1.

See gh-34692
2025-04-02 17:10:01 +02:00
rstoyanchev 290c9c4a19 Use form charset in ServletServerHttpRequest
Closes gh-34675
2025-04-02 09:05:52 +01:00
rstoyanchev e01ad5a08d Polishing in ServletServerHttpRequest
See gh-34675
2025-04-02 09:05:52 +01:00
Brian Clozel b8158df3d6 Create new observation context for WebClient retries
Prior to this commit, the `DefaultWebClient` observability
instrumentation would create the observation context before the reactive
pipeline is fully materialized. In case of errors and retries (with the
`retry(long)` operator), the observation context would be reused for
separate observations, which is incorrect.

This commit ensures that a new observation context is created for each
subscription.

Fixes gh-34671
2025-04-02 09:37:16 +02:00
Juergen Hoeller c4e25a1162 Upgrade to Jetty 12.0.18, Apache HttpClient 5.4.3, Protobuf 4.30.2, Checkstyle 10.22 2025-04-01 23:24:25 +02:00
Juergen Hoeller 48009c8534 Introduce support for concurrent startup phases with timeouts
Closes gh-34634
2025-04-01 22:18:26 +02:00
Juergen Hoeller 203ca30a64 Include cause in MethodInvocationException message
Closes gh-34691
2025-04-01 22:12:17 +02:00
Juergen Hoeller 34ea0461c7 Polishing 2025-04-01 22:12:09 +02:00
Dmitry Sulman fbaeaf12bd Recursively boxing Kotlin nested value classes
This commit is a follow-up to gh-34592. It introduces
recursive boxing of Kotlin nested value classes in CoroutinesUtils.

Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
Closes gh-34682
2025-04-01 09:53:23 +02:00
Juergen Hoeller 7b08feeb6d Make jar caching configurable through setUseCaches
Closes gh-34678
2025-03-31 16:41:16 +02:00
Juergen Hoeller 743f32675d Only attempt load for CGLIB classes in AOT mode
Closes gh-34677
2025-03-31 16:39:18 +02:00
Juergen Hoeller 3ddc607b3e Add spring.locking.strict property to common appendix
See gh-34303
2025-03-31 16:38:28 +02:00
rstoyanchev f68fb97e7e Remove outdated notes on forwarded headers.
Closes gh-34625
2025-03-31 11:36:15 +01:00
Sam Brannen 044258f085 Support abstract @⁠Configuration classes without @⁠Bean methods again
Historically, @⁠Configuration classes that did not declare @⁠Bean
methods were allowed to be abstract. However, the changes made in
76a6b9ea79 introduced a regression that prevents such classes from
being abstract, resulting in a BeanInstantiationException. This change
in behavior is caused by the fact that such a @⁠Configuration class is
no longer replaced by a concrete subclass created dynamically by CGLIB.

This commit restores support for abstract @⁠Configuration classes
without @⁠Bean methods by modifying the "no enhancement required" check
in ConfigurationClassParser.

See gh-34486
Closes gh-34663
2025-03-31 12:18:55 +02:00
Sam Brannen 36d9357f94 Fix Kotlin compilation errors 2025-03-31 12:02:51 +02:00
Sébastien Deleuze dcb9383ba1 Add a requiredExchange extension to RestClient
Closes gh-34692
2025-03-31 11:55:41 +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
Sam Brannen 9fd1d0c6a3 Polish Javadoc
This commit also reverts the change to ASM's SymbolTable class.

See gh-34679
2025-03-29 12:57:08 +01:00
Tran Ngoc Nhan 30fcaef813 Remove unnecessary closing curly brackets in Javadoc
Closes gh-34679

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-03-29 12:37:48 +01:00
Juergen Hoeller 75e5a75da5 Enforce circular reference exception within non-managed thread
Closes gh-34672
2025-03-28 20:46:09 +01:00
Juergen Hoeller 9bf01df230 Evaluate lenientLockingAllowed flag per DefaultListableBeanFactory instance
See gh-34303
2025-03-28 20:45:06 +01:00
Sam Brannen 8d2166139f Update SpringCoreTestSuite to include AOT 2025-03-27 16:04:51 +01:00
Sam Brannen 374c3b4545 Provide complete support for qualifier annotations with Bean Overrides
Prior to this commit, the Test Bean Override feature provided support
for overriding beans based on qualifier annotations in several
scenarios; however, qualifier annotations got lost if they were
declared on the return type of the @⁠Bean method for the bean being
overridden and the @⁠BeanOverride (such as @⁠MockitoBean) was based on
a supertype of that return type.

To address that, this commit sets the @⁠BeanOverride field as the
"qualified element" in the RootBeanDefinition to ensure that qualifier
annotations are available for subsequent autowiring candidate
resolution.

Closes gh-34646
2025-03-27 15:29:14 +01:00
Sam Brannen d7e470d3e0 Polishing 2025-03-27 14:05:25 +01:00
Stéphane Nicoll 2862c87601 Make sure the generated values are available from a static context
This commit updates the tests of property values code generated to
invoke the generated code from a `static` context. This ensures that
the test fails if that's not the case.

This commit also updated LinkedHashMap handling that did suffer from
that problem.

Closes gh-34659
2025-03-27 12:06:18 +01:00
Juergen Hoeller aa56b5001a Detect late-set primary markers for autowiring shortcut algorithm
Closes gh-34658
2025-03-26 23:47:42 +01:00
Juergen Hoeller 84430a8db2 Polishing 2025-03-25 17:09:24 +01:00
Juergen Hoeller 6905dff660 Introduce spring.locking.strict=true flag for 6.1.x style bean creation locking
Closes gh-34303
2025-03-25 17:08:55 +01:00
Juergen Hoeller 20736bd06f Introduce acknowledgeAfterListener flag for custom acknowledge handling
Closes gh-34635
2025-03-25 17:06:28 +01:00
Juergen Hoeller 37fb79e8ff Fix qualifier resolution for aliased name against parent factory
Closes gh-34644
2025-03-25 00:08:42 +01:00
Juergen Hoeller d8f8e76791 Check potentially more specific HibernateException cause as well
Closes gh-34633
2025-03-21 15:53:24 +01:00
Juergen Hoeller dc41ff569e Add javadoc notes on potential exception suppression in getBeansOfType
Closes gh-34629
2025-03-21 15:52:42 +01:00
Juergen Hoeller 47651350f3 Polishing 2025-03-21 10:58:40 +01:00
rstoyanchev 15c20c3e65 Fix regression with opaque URI determination
Before RfcUriParser we expected opaque URI's to not have ":/"
after the scheme while the new parser expect opaque URI's to
not have a slash anywhere after the scheme. This commit
restores the previous behavior.

Closes gh-34588
2025-03-21 09:05:41 +00:00
Dmitry Sulman 5455c645f0 Update deprecated Gradle task creation
This commit replaces use of the deprecated Gradle `task` method with
the new `tasks.register` method.

Closes gh-34617

Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
2025-03-20 10:22:55 +01:00
Brian Clozel adb4b675fc Next development version (v6.2.6-SNAPSHOT) 2025-03-19 18:18:50 +01:00
Sam Brannen 208d52d852 Introduce Checkstyle rule for separator symbol location 2025-03-19 15:35:44 +01:00
rstoyanchev 18c3b637e4 Fix dated Javadoc in MvcUriComponentsBuilder
related to forwarded headers

Closes gh-34615
2025-03-19 12:33:01 +00:00
rstoyanchev 34c69bfc67 Allow empty comment in ServerResponse.SseBuilder
Closes gh-34608
2025-03-19 12:14:37 +00:00
rstoyanchev 37d7af42ac Allow setting ApplicationContext on MockServerWebExchange
Closes gh-34601
2025-03-19 11:06:38 +00:00
Juergen Hoeller cc986cd2e8 Defer triggerAfterCompletion invocation in doRollbackOnCommitException
Closes gh-34595
2025-03-19 10:59:46 +01:00
Sébastien Deleuze 0141725638 Polishing
Closes gh-34592
2025-03-18 17:50:28 +01:00
Dmitry Sulman 0c2ba4e38e Recursively box/unbox nested inline value classes
See gh-34592
Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
2025-03-18 17:50:28 +01:00
Sam Brannen c6a9aa59a3 Remove BDDMockito Checkstyle rule
This commit removes the BDDMockito Checkstyle rule, since it did not
actually enforce the use of BDDMockito.

This commit also updates static imports to use Mockito instead of
BDDMockito where appropriate (automated via the Eclipse IDE Organize
Imports clean-up task).

Closes gh-34616
2025-03-18 16:35:57 +01:00
Juergen Hoeller ad949a7450 Add includeNonSingletons flag for ObjectProvider stream access
Closes gh-34591
2025-03-18 16:10:30 +01:00
Juergen Hoeller 86b2617c7f Suggest compilation with -parameters in case of ambiguity
Closes gh-34609
2025-03-17 19:22:56 +01:00
Juergen Hoeller 760376c318 Restore check for jar root existence (now via getEntryName/getJarEntry)
Closes gh-34607
2025-03-17 19:20:41 +01:00
Juergen Hoeller 5b6abe4c13 Upgrade to ASM 9.8 (for early Java 25 support)
Closes gh-34600
2025-03-17 19:16:42 +01:00
Sam Brannen 7a839e988a Make dependencies on AssertJ and JUnit in spring-core-test optional
This commit also removes unnecessary dependencies in
spring-core-test.gradle and updates framework-docs.gradle accordingly.

Closes gh-34612
2025-03-17 18:11:25 +01:00
Sébastien Deleuze 46859d6391 Polishing
Closes gh-34594
2025-03-17 11:39:15 +01:00
Russell Bolles 573e74b8bd Refine FormHttpMessageConverter exception handling
FormHttpMessageConverter could throw a more specific
HttpMessageNotReadableException instead of an IllegalArgumentException
when the http form data is invalid.

See gh-34594
Signed-off-by: Russell Bolles <rbolles@netflix.com>
2025-03-17 11:37:42 +01:00
Sam Brannen 6c231804a0 Upgrade to Mockito 5.16.1 2025-03-16 15:33:33 +01:00
Tran Ngoc Nhan 7c3913050a 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>
(cherry picked from commit 666e2df0f3)
2025-03-15 13:51:28 +01:00
Sam Brannen ec488282a8 Upgrade to JUnit 5.12.1 2025-03-14 18:03:23 +01:00
Juergen Hoeller 911cdb2ad0 Add resolveAutowireCandidates variant with includeNonSingletons and allowEagerInit
Closes gh-34591
2025-03-13 18:48:43 +01:00
Brian Clozel 0f83c483bb Remove invalid link from reference documentation
Closes gh-34593
2025-03-13 15:26:09 +01:00
Sébastien Deleuze c9050607bc Fix StringUtils#uriDecode Javadoc
Closes gh-34590
2025-03-13 12:57:44 +01:00
Brian Clozel 5e82ee6bd7 Next development version (v6.2.5-SNAPSHOT) 2025-03-13 09:44:23 +01:00
Juergen Hoeller 387677eae8 Upgrade to JUnit 5.12
Closes gh-34416
2025-03-12 12:46:34 +01:00
Juergen Hoeller 4a314867d7 Upgrade to Reactor 2024.0.4 and Micrometer 1.14.5
Closes gh-34578
Closes gh-34580
2025-03-12 11:51:33 +01:00
Sam Brannen 020f556841 Support custom attribute with a value in MockCookie.parse()
Prior to this commit, MockCookie.parse() failed with an
IllegalArgumentException when attempting to parse a custom attribute
with a value, such as "Version=1". This is a regression that was
inadvertently introduced in 7fc4937199
when adding support for the "Partitioned" attribute which does not
support a value.

This commit addresses this regression by parsing both the name and the
value from an optional, custom attribute.

See gh-31454
Closes gh-34575
2025-03-12 11:19:38 +01:00
rstoyanchev 6ea3b5a0e8 Fix Javadoc failure
See gh-34549
2025-03-10 20:59:33 +00:00
rstoyanchev d764087dbf Correct since tag
See gh-34549
2025-03-10 18:17:47 +00:00
rstoyanchev 9ab43b138a Enhancement in HandlerMethodValidationException
Add dedicated method to Visitor for constraints directly on a
RequestBody method parameter (rather than nested).

Closes gh-34549
2025-03-10 18:01:55 +00:00
rstoyanchev 09ae080b99 isDisconnectedClientException protected for null
Closes gh-34533
2025-03-10 17:19:13 +00:00
Juergen Hoeller 70a1b2fae3 Upgrade to Checkstyle 10.21.4 2025-03-10 11:00:53 +01:00
Juergen Hoeller 90ddb40d7a Upgrade to Jetty 12.0.17 and Jetty Reactive HttpClient 4.0.9
Includes Apache HttpClient 5.4.1, Netty 4.1.119, Jackson 2.18.3, Gson 2.12.1, FreeMarker 2.3.34, Protobuf 4.30, Groovy 4.0.26, Jython 2.7.4, JRuby 9.4.12, Caffeine 3.2, QDox 2.2, Awaitility 4.3, EasyMock 5.5, HtmlUnit 4.10

Closes gh-34561
2025-03-10 11:00:35 +01:00
Juergen Hoeller 143985e862 Add tests for primary/fallback/defaultCandidate precedence
Closes gh-34449
2025-03-08 12:22:14 +01:00
Juergen Hoeller 4bd280b87e Explain availability and uniqueness (including primary/fallback/default) in javadoc
Closes gh-34447
2025-03-08 12:22:04 +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
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
Dmitry Sulman a6f3f18d89 Allow supertypes in ContentResultMatchersDsl matchers
Closes gh-34542
Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
2025-03-07 09:29:48 +01:00
Sam Brannen 8334cb1abb Revise tests to better express intent 2025-03-06 17:32:32 +01:00
Sam Brannen 2d88f18bf1 Update Javadoc 2025-03-06 16:26:40 +01:00
Sam Brannen 15a6641677 Clean up warnings in Gradle build 2025-03-06 16:26:32 +01:00
Juergen Hoeller 63c8e7cb5d Restore lenient matching of unresolved nested bound
Closes gh-34541
2025-03-06 15:44:12 +01:00
Sam Brannen c5ecc50bfe Document wrapping behavior for TestExecutionListener callbacks
Closes gh-34422
2025-03-06 13:31:23 +01:00
Sam Brannen 0fd94f1b9f Polishing 2025-03-06 13:30:20 +01:00
Juergen Hoeller 2472126475 Add fallback to pre-6.2.3 behavior for unresolvable generics
Closes gh-34535
2025-03-05 22:45:22 +01:00
Juergen Hoeller f3b50c9a58 Ignore null beans in SimpleAutowireCandidateResolver.resolveAutowireCandidates
Closes gh-34543
2025-03-05 22:44:09 +01:00
Sam Brannen 0a6e666857 Ensure GenericTypeResolverTests compiles with Eclipse compiler 2025-03-05 14:07:52 +01:00
Juergen Hoeller 403362fe3c Polishing 2025-03-04 18:44:56 +01:00
Juergen Hoeller 534f123fe8 Add explicit FileSystemResource path check for trailing slash
Closes gh-34509
2025-03-04 18:44:25 +01:00
Sam Brannen e421104cf3 Supply RuntimeHints to an AotContextLoader
This commit introduces a new loadContextForAotProcessing(...) variant
in AotContextLoader which accepts a RuntimeHints argument. This new
method is an interface default method which delegates to the existing
loadContextForAotProcessing(MergedContextConfiguration) variant for
backward compatibility.

In addition, the original loadContextForAotProcessing(...) variant is
now deprecated and has been converted to an interface default method
which throws an UnsupportedOperationException.

Note, however, that the framework now only invokes the new
loadContextForAotProcessing(...) variant within TestContextAotGenerator.

Closes gh-34513
2025-03-03 17:39:56 +01:00
Sam Brannen adfeba23e0 Polishing 2025-03-03 17:39:47 +01:00
Sam Brannen 7789e12575 Polishing 2025-03-03 15:04:42 +01:00
Sam Brannen 30d793cefe Revise deprecation of SqlQuery.rowsExpected
Closes gh-34526
2025-03-03 14:33:19 +01:00
Yanming Zhou 78cc5df748 Deprecate unused "rowsExpected" property of SqlQuery for removal
See gh-34526

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-03-03 14:33:14 +01:00
Juergen Hoeller 5ffaea7a43 Avoid JarURLConnection resource leak in AbstractFileResolvingResource.exists()
Closes gh-34528
2025-03-03 13:32:51 +01:00
Brian Clozel 1633ad24f3 Ignore nohttp check on buildSrc/build 2025-03-03 11:23:21 +01:00
Rhett CfZhuang 5faf2ed7f4 Fix missing Partitioned cookie support in reactive HTTP clients
This commit adds support for the Partitioned cookie attribute in the
reactive HTTP clients that support this: Reactor and HttpComponents.

Closes gh-34521

Signed-off-by: Rhett CfZhuang <dark.momo985@gmail.com>
[brian.clozel@broadcom.com: rework tests and support HttpComponents]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
2025-03-03 11:23:13 +01:00
Juergen Hoeller d2733cea36 Notify lenientCreationFinished condition after locked creation as well
Closes gh-34522
2025-03-01 22:20:23 +01:00
Johnny Lim 108caea385 Use ORDER constant in MockitoResetTestExecutionListener
See gh-34404
Closes gh-34445

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-03-01 13:35:46 +01:00
rstoyanchev 7e9ac120ac Deprecate UrlPathHelper in ServletWebSocketHandlerRegistry
Closes gh-34508
2025-02-28 14:39:29 +00:00
Juergen Hoeller c64dae3623 Avoid getTargetConnection call on transaction-aware Connection close
Closes gh-34484
2025-02-28 14:12:51 +01:00
Juergen Hoeller 559ea6c480 Defensively call isShutdown method for executor description
Closes gh-34514
2025-02-28 14:11:57 +01:00
Tran Ngoc Nhan 34315fc20f Fix web and webflux reference links
Closes gh-34517
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-02-28 12:06:11 +01:00
Juergen Hoeller 3bb4795d43 Resolve variable bounds at outermost recursion level only
Closes gh-34504
2025-02-27 22:51:41 +01:00
Ryan Prayogo aae2952a32 Replace DefaultKeyGenerator with SimpleKeyGenerator
DefaultKeyGenerator has been deprecated and replaced with SimpleKeyGenerator

Signed-off-by: Ryan Prayogo <57620+ryanprayogo@users.noreply.github.com>
2025-02-27 18:53:10 +01:00
rstoyanchev f62251aebd Avoid pathVar-requestParam name collision
Closes gh-34499
2025-02-27 14:34:26 +00:00
rstoyanchev f92f9c1d5b Fix handling of timeout in SseEmitter
Closes gh-34426
2025-02-27 14:34:26 +00:00
Sam Brannen 2b38c00656 Upgrade to Gradle 8.13
Closes gh-34495
2025-02-26 15:26:49 +01:00
Juergen Hoeller 06721ba6c0 Lenient fallback when cached WeakReference returns null
Closes gh-34423
2025-02-26 10:24:24 +01:00
Brian Clozel b6a5402d88 Fix multiple Content-Language values in MockHttpServletResponse
Prior to this commit, `MockHttpServletResponse` would only support
adding a `Content-Language` once. Adding multiple header values would
always replace the content-language property in the response and the
entire header value.

This commit ensures that this behavior is supported.

Fixes gh-34488
2025-02-25 17:11:37 +01:00
Juergen Hoeller aff9ac72ec Avoid unnecessary CGLIB processing on configuration classes
Closes gh-34486
2025-02-25 16:20:12 +01:00
Brian Clozel f895d762cd Remove duplicate Content-Type header in error cases
Prior to this commit, the `DispatcherServlet` would try and reset the
response buffer in case of errors, if the response is not committed
already. This allows for more flexible error handling, even if the
response was being handled already when it errored.

Resetting the response buffer clears the body but leaves HTTP response
headers intact. This is done on purpose as to not clear headers
previously added by Servlet Filters. By leaving in place some headers
like "Content-Type", this does not take into account the fact that the
response body was cleared and that error handling will perform another
round of content negotiation. While this isn't a problem for some
Servlet containers which enforce a single "Content-Type" header value,
this can cause multiple/duplicate values for some others.

This commit ensures that the "Content-Type" response header is removed
at the same time as we clear the "producible media types" attribute:
another pass of content negotiation will be performed for error
handling.

Fixes gh-34366
2025-02-25 10:43:19 +01:00
Juergen Hoeller 634d1dd20b Consistent default ClassLoader fallback in hint classes
Closes gh-34470
2025-02-23 15:15:25 +01:00
Juergen Hoeller 725b02a66d Ignore entries cache if no matching root entry path found
Closes gh-34446
2025-02-23 14:02:57 +01:00
Brian Clozel 5a0bd9e5d4 Fix null value support in ContentCachingResponseWrapper
Prior to this commit, calling `setHeader` on the response wrapper would
have a separate code path for the "Content-Length" header. This did not
support calls with `null` values and would result in an exception.

This commit ensures that the cached content length value is reset in
this case and that the call is forwarded properly to the superclass.

Fixes gh-34460
2025-02-21 14:33:03 +01:00
Brian Clozel 6dd73ae3e4 Handle null values in MockHttpServletResponse#setHeader
Prior to this commit, `MockHttpServletResponse#setHeader` would not
remove the header entry when given a `null` value, as documented in the
Servlet API.
This commit ensures that this behavior is enforced.

Fixes gh-34464
2025-02-21 14:23:12 +01:00
Gang Cheng 4606337180 Prevent hung uploads in MultipartParser
This commit adds an onRequest() hook to request more data from
the source in order to avoid hung uploads in MultipartParser.

Closes gh-34388
Signed-off-by: Gang Cheng <chenggangpro@gmail.com>
2025-02-21 11:32:54 +01:00
Sébastien Deleuze f45a08d4f5 Remove BaseDefaultCodecs#synchronossMultipartPresent
Closes gh-34459
2025-02-20 09:07:26 +01:00
Sébastien Deleuze d62ce2969a Fix broken antora task
See https://github.com/spring-io/antora-extensions/pull/43

Closes gh-34454
2025-02-19 16:40:50 +01:00
Johnny Lim ed3fd12210 Add missing @since tags in MockHttpServletRequestDsl
This commit adds missing `@since` tags for formField() and formFields in
MockHttpServletRequestDsl. See gh-34412 related issue.

Closes gh-34448
Signed-off-by: Johnny Lim <izeye@naver.com>
2025-02-19 13:58:31 +01:00
Vincent Potucek 6f596e2e84 Add a project icon for IntelliJ IDEA
The icon comes from https://spring.io/img/projects/spring-framework.svg.

Closes gh-34444
Signed-off-by: Vincent Potucek <vincent.potucek@sap.com>
2025-02-19 13:45:16 +01:00
Juergen Hoeller 6786e1c3e5 Apply fallback in case of initial SmartClassLoader mismatch as well
See gh-34423
2025-02-18 20:40:13 +01:00
Juergen Hoeller 93134fd4d1 Apply fallback in case of any exception coming out of createClass
Closes gh-34423
2025-02-18 15:16:25 +01:00
Juergen Hoeller d0ceefedc6 Mark XML-configured executor/scheduler as infrastructure bean
Closes gh-34015
2025-02-18 13:13:34 +01:00
Juergen Hoeller e230ea537c Consistently resolve unique default candidate bean
Closes gh-34432
2025-02-18 13:11:36 +01:00
Juergen Hoeller 94eb6006e8 Leniently accept same singleton instance if implicitly appeared
Closes gh-34427
2025-02-18 13:01:08 +01:00
Sébastien Deleuze 2576702cda Use public interface for HTTP Interface documentation
Closes gh-34443
2025-02-18 11:57:04 +01:00
Sébastien Deleuze 2099e046d3 Polishing
See gh-34439
2025-02-18 11:40:16 +01:00
Sébastien Deleuze 2ee7a8e77a Add missing converters to DefaultRestClientBuilder
With this commit, DefaultRestClientBuilder configures the same
default converters than RestTemplate.

Closes gh-34439
2025-02-18 11:19:07 +01:00
Johnny Lim 3c40e5e501 Add Javadoc since for HandlerMethod(HandlerMethod, Object, boolean)
See 56c4d2d

Closes gh-34431
Signed-off-by: Johnny Lim <izeye@naver.com>
2025-02-16 12:10:01 +01:00
Sam Brannen 9e45178202 Stop referring to "Java 8" in AnnotationUtils 2025-02-13 15:59:20 +01:00
Sam Brannen d82e70e345 Cross reference annotation search APIs in Javadoc
Closes gh-34421
2025-02-13 15:59:08 +01:00
Stéphane Nicoll 1109892134 Next development version (v6.2.4-SNAPSHOT) 2025-02-13 14:19:02 +01:00
9116 changed files with 44711 additions and 28040 deletions
@@ -15,7 +15,7 @@ runs:
using: composite
steps:
- name: Generate Changelog
uses: spring-io/github-changelog-generator@185319ad7eaa75b0e8e72e4b6db19c8b2cb8c4c1 #v0.0.11
uses: spring-io/github-changelog-generator@86958813a62af8fb223b3fd3b5152035504bcb83 #v0.0.12
with:
config-file: .github/actions/create-github-release/changelog-generator.yml
milestone: ${{ inputs.milestone }}
@@ -24,14 +24,14 @@ runs:
using: composite
steps:
- name: Set Up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: ${{ inputs.java-early-access == 'true' && 'temurin' || (inputs.java-distribution || 'liberica') }}
java-version: |
${{ inputs.java-early-access == 'true' && format('{0}-ea', inputs.java-version) || inputs.java-version }}
${{ inputs.java-toolchain == 'true' && '17' || '' }}
- name: Set Up Gradle
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
with:
cache-read-only: false
develocity-access-key: ${{ inputs.develocity-access-key }}
@@ -1,18 +1,15 @@
name: Sync to Maven Central
description: 'Syncs a release to Maven Central and waits for it to be available for use'
inputs:
central-token-password:
description: 'Password for authentication with central.sonatype.com'
required: true
central-token-username:
description: 'Username for authentication with central.sonatype.com'
required: true
jfrog-cli-config-token:
description: 'Config token for the JFrog CLI'
required: true
ossrh-s01-staging-profile:
description: 'Staging profile to use when syncing to Central'
required: true
ossrh-s01-token-password:
description: 'Password for authentication with s01.oss.sonatype.org'
required: true
ossrh-s01-token-username:
description: 'Username for authentication with s01.oss.sonatype.org'
required: true
spring-framework-version:
description: 'Version of Spring Framework that is being synced to Central'
required: true
@@ -20,23 +17,17 @@ runs:
using: composite
steps:
- name: Set Up JFrog CLI
uses: jfrog/setup-jfrog-cli@f748a0599171a192a2668afee8d0497f7c1069df # v4.5.6
uses: jfrog/setup-jfrog-cli@5b06f730cc5a6f55d78b30753f8583454b08c0aa # v4.8.1
env:
JF_ENV_SPRING: ${{ inputs.jfrog-cli-config-token }}
- name: Download Release Artifacts
shell: bash
run: jf rt download --spec ${{ format('{0}/artifacts.spec', github.action_path) }} --spec-vars 'buildName=${{ format('spring-framework-{0}', inputs.spring-framework-version) }};buildNumber=${{ github.run_number }}'
- name: Sync
uses: spring-io/nexus-sync-action@42477a2230a2f694f9eaa4643fa9e76b99b7ab84 # v0.0.1
uses: spring-io/central-publish-action@0c03960e9b16fdfe70e2443e1d5393cbc3a35622 # v0.3.0
with:
close: true
create: true
generate-checksums: true
password: ${{ inputs.ossrh-s01-token-password }}
release: true
staging-profile-name: ${{ inputs.ossrh-s01-staging-profile }}
upload: true
username: ${{ inputs.ossrh-s01-token-username }}
token: ${{ inputs.central-token-password }}
token-name: ${{ inputs.central-token-username }}
- name: Await
uses: ./.github/actions/await-http-resource
with:
+2 -2
View File
@@ -18,9 +18,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'liberica'
java-version: 17
@@ -13,7 +13,7 @@ jobs:
timeout-minutes: 60
steps:
- name: Check Out Code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Build and Publish
id: build-and-publish
uses: ./.github/actions/build
@@ -21,7 +21,7 @@ jobs:
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
publish: true
- name: Deploy
uses: spring-io/artifactory-deploy-action@dc1913008c0599f0c4b1fdafb6ff3c502b3565ea # v0.0.2
uses: spring-io/artifactory-deploy-action@926d7f7cc810569395346bf3a4d91b380b3e355b # v0.0.4
with:
artifact-properties: |
/**/framework-api-*.zip::zip.name=spring-framework,zip.deployed=false
+2 -2
View File
@@ -10,7 +10,7 @@ jobs:
timeout-minutes: 60
steps:
- name: Check Out Code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Build
id: build
uses: ./.github/actions/build
@@ -19,7 +19,7 @@ jobs:
uses: ./.github/actions/print-jvm-thread-dumps
- name: Upload Build Reports
if: failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: build-reports
path: '**/build/reports/'
+2 -2
View File
@@ -21,7 +21,7 @@ jobs:
toolchain: false
- version: 21
toolchain: true
- version: 23
- version: 25
toolchain: true
exclude:
- os:
@@ -36,7 +36,7 @@ jobs:
git config --global core.longPaths true
Stop-Service -name Docker
- name: Check Out Code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Build
id: build
uses: ./.github/actions/build
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 1
ref: docs-build
+7 -8
View File
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check Out Code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Build and Publish
id: build-and-publish
uses: ./.github/actions/build
@@ -20,7 +20,7 @@ jobs:
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
publish: true
- name: Stage Release
uses: spring-io/artifactory-deploy-action@dc1913008c0599f0c4b1fdafb6ff3c502b3565ea # v0.0.2
uses: spring-io/artifactory-deploy-action@926d7f7cc810569395346bf3a4d91b380b3e355b # v0.0.4
with:
artifact-properties: |
/**/framework-api-*.zip::zip.name=spring-framework,zip.deployed=false
@@ -56,14 +56,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check Out Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@v6
- name: Sync to Maven Central
uses: ./.github/actions/sync-to-maven-central
with:
central-token-password: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
central-token-username: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
jfrog-cli-config-token: ${{ secrets.JF_ARTIFACTORY_SPRING }}
ossrh-s01-staging-profile: ${{ secrets.OSSRH_S01_STAGING_PROFILE }}
ossrh-s01-token-password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
ossrh-s01-token-username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
spring-framework-version: ${{ needs.build-and-stage-release.outputs.version }}
promote-release:
name: Promote Release
@@ -73,7 +72,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up JFrog CLI
uses: jfrog/setup-jfrog-cli@dff217c085c17666e8849ebdbf29c8fe5e3995e6 # v4.5.2
uses: jfrog/setup-jfrog-cli@5b06f730cc5a6f55d78b30753f8583454b08c0aa # v4.8.1
env:
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
- name: Promote build
@@ -86,7 +85,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check Out Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@v6
- name: Create GitHub Release
uses: ./.github/actions/create-github-release
with:
+5 -5
View File
@@ -30,23 +30,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check Out Release Verification Tests
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
ref: 'v0.0.2'
repository: spring-projects/spring-framework-release-verification
token: ${{ secrets.token }}
- name: Check Out Send Notification Action
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
path: send-notification
sparse-checkout: .github/actions/send-notification
- name: Set Up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'liberica'
java-version: 17
- name: Set Up Gradle
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
with:
cache-read-only: false
- name: Configure Gradle Properties
@@ -64,7 +64,7 @@ jobs:
run: ./gradlew spring-framework-release-verification-tests:test
- name: Upload Build Reports on Failure
if: failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: build-reports
path: '**/build/reports/'
+3 -1
View File
@@ -9,6 +9,7 @@ ivy-cache
argfile*
activemq-data/
classes/
.cursor/
# Log files
jxl.log
@@ -42,7 +43,8 @@ spring-*/src/main/java/META-INF/MANIFEST.MF
*.iml
*.ipr
*.iws
.idea
.idea/*
!.idea/icon.svg
out
test-output
atlassian-ide-plugin.xml
+52
View File
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 510 510" style="enable-background:new 0 0 510 510;" xml:space="preserve">
<style type="text/css">
.st0{fill:#6DB33F;}
</style>
<title>icon-framework</title>
<g id="Layer_2_1_">
<g id="Layer_1-2">
<path class="st0" d="M479.2,162.5c-5.6-34.3-20.5-64.4-43.9-87.8S382,36.5,347.6,30.9C320.1,11.2,288.5,0,255,0
s-65.1,11.2-92.6,30.9C128,36.5,98,51.3,74.7,74.7C50.9,98.4,36.5,128.7,31,162.2C11.2,189.8,0,221.4,0,255s11.2,65.2,31,92.8
c5.5,33.5,19.9,63.8,43.7,87.5c23.3,23.3,53.3,38.2,87.7,43.8C190,498.8,221.5,510,255,510s65-11.2,92.6-30.9
c34.4-5.6,64.4-20.5,87.7-43.8c23.8-23.8,38.1-54.1,43.7-87.5c19.8-27.6,31-59.2,31-92.8S498.8,190,479.2,162.5z M473,224.2
c-0.8,6-1.9,11.9-3.2,17.9c-7.2-22.4-17.1-43.8-29.4-63.8c-5.5-22.8-13.6-44.9-24.4-65.8c22.9,14.8,42.2,32.6,56.7,52.6
C475.7,184.6,475.8,204.6,473,224.2z M444.7,199.6c9.3,17.7,16.6,36.3,21.9,55.6c-5.3,19.3-12.7,37.9-22,55.6
C450.9,274,451,236.4,444.7,199.6L444.7,199.6z M175.4,341.1c6.5-4.5,13.7-7.8,21.3-9.8c32.2-7.5,46.7-9.9,66.3-18.4
c36.8-15.9,74.8-53.3,84.6-94c-16.1,38.8-59.5,70.2-97.9,81.6c-26.2,7.8-79.8,13.6-80.1,13.6l-1.4-1.2
c-30.6-17.4-27-85.8,31.8-104.1c25.7-8,55.9-0.7,83.5-5.4c29.4-5,64.4-24.5,79.9-52c12.3,46.4,26.1,118.5-9.7,160.2
C309.4,363,211.8,318,175.4,341.1z M310.8,444.6c-17.7,9.4-36.5,16.8-55.8,22.1c-19.4-5.3-38.1-12.7-55.8-22.1
C236.1,450.9,273.9,450.9,310.8,444.6z M117.6,392.4c13.1,13.1,27.3,25.1,42.3,35.8c-19-5.9-37.2-13.8-54.5-23.7
c-9.9-17.3-17.8-35.7-23.7-54.7C92.4,365.1,104.5,379.3,117.6,392.4z M81.7,160.1c5.9-19,13.9-37.4,23.7-54.7
c17.3-9.8,35.5-17.8,54.5-23.7c-15.1,10.8-29.2,22.7-42.3,35.8C104.5,130.7,92.4,144.9,81.7,160.1z M149.1,346.4
c-8.5,0.2-15.5-6.5-15.7-15c-0.2-8.5,6.5-15.5,15-15.7c8.5-0.2,15.5,6.5,15.7,15c0,0,0,0.1,0,0.1
C164.2,339.3,157.5,346.2,149.1,346.4L149.1,346.4z M199.2,65.4c17.7-9.4,36.5-16.8,55.8-22.1c19.4,5.3,38.1,12.7,55.8,22.1
C273.9,59.1,236.1,59.1,199.2,65.4L199.2,65.4z M392.4,392.4c13.1-13.1,25.1-27.3,35.9-42.4c-5.9,19-13.9,37.3-23.7,54.5
c-17.3,9.8-35.5,17.7-54.5,23.7C365.2,417.5,379.3,405.5,392.4,392.4L392.4,392.4z M392.4,117.6c-13.1-13.1-27.2-25.1-42.3-35.8
c19,5.9,37.2,13.9,54.5,23.7c9.8,17.3,17.8,35.6,23.7,54.7C417.6,144.9,405.5,130.7,392.4,117.6L392.4,117.6z M430.5,79.5
c19.4,19.3,32.6,43.6,39.3,71.1c-16.2-19.2-36.6-36.2-60.4-50c-13.8-23.8-30.8-44.2-50-60.4C387.1,46.9,411.2,60.1,430.5,79.5
L430.5,79.5z M397.6,94c-20.8-10.7-42.8-18.8-65.6-24.2c-20-12.4-41.5-22.4-63.9-29.6c15.5-3.4,31.3-5.1,47.2-5.2
c10,0,19.9,0.8,29.7,2.3C365.1,51.8,382.8,71.1,397.6,94z M255,6.8c27.6,0,53.8,8,77.4,22.2c-5.6-0.5-11.3-0.7-17.1-0.7
c-20.4,0.1-40.6,2.8-60.3,8.1c-19.7-5.3-39.9-8-60.3-8.1c-5.8,0-11.5,0.2-17.1,0.7C201.2,14.7,227.4,6.8,255,6.8z M165,37.3
c9.8-1.5,19.8-2.3,29.7-2.3c15.9,0.1,31.7,1.8,47.2,5.2C219.5,47.4,198,57.3,178,69.8c-22.7,5.4-44.8,13.6-65.6,24.2
C127.2,71.1,144.9,51.8,165,37.3z M79.5,79.5c19.3-19.3,43.5-32.6,71.1-39.3c-19.2,16.2-36.2,36.6-50,60.4
c-23.7,13.8-44,30.6-60.2,49.8C47,123.4,59.8,99.1,79.5,79.5z M37.4,164.9c14.6-20,33.8-37.7,56.6-52.4
c-10.7,20.9-18.8,43-24.3,65.8c-12.3,20-22.2,41.4-29.4,63.8C34.6,215.4,33.5,189.3,37.4,164.9z M65.4,310.4
c-9.3-17.6-16.6-36.2-21.9-55.4c5.3-19.2,12.6-37.8,21.9-55.4C59.1,236.3,59.1,273.7,65.4,310.4L65.4,310.4z M29.2,332.8
c-14.4-23.7-22.4-50-22.4-77.8s8.1-54.1,22.4-77.8c-2.1,25,0.4,51.3,7.4,77.8C29.5,281.5,27,307.8,29.2,332.8z M40.3,268
c7.2,22.3,17.1,43.7,29.4,63.7c5.5,22.8,13.6,44.9,24.3,65.8c-22.8-14.7-42-32.5-56.6-52.4C33.5,320.7,34.6,294.6,40.3,268z
M79.5,430.5c-19.6-19.6-32.5-43.9-39.1-70.9c16.1,19.1,36.5,36,60.2,49.8c13.8,23.7,30.8,44.2,50,60.4
C122.9,463.1,98.8,449.9,79.5,430.5z M112.5,416c20.8,10.7,42.8,18.8,65.5,24.2c20,12.4,41.5,22.4,63.9,29.6
c-15.5,3.4-31.3,5.1-47.2,5.1c-10,0-19.9-0.8-29.7-2.3C144.9,458.1,127.2,438.9,112.5,416L112.5,416z M255,503.2
c-27.6,0-53.8-8-77.4-22.2c5.6,0.5,11.3,0.7,17.1,0.7c20.4-0.1,40.6-2.8,60.3-8.1c19.7,5.3,39.9,8,60.3,8.1
c5.8,0,11.5-0.2,17.1-0.7C308.8,495.3,282.6,503.2,255,503.2z M345,472.7c-9.8,1.5-19.8,2.3-29.7,2.3c-15.9-0.1-31.7-1.8-47.2-5.1
c22.4-7.2,43.9-17.2,63.9-29.6c22.7-5.4,44.8-13.6,65.6-24.2C382.8,438.9,365.1,458.1,345,472.7z M430.5,430.5
c-19.3,19.3-43.5,32.6-71.1,39.3c19.2-16.2,36.2-36.6,50-60.4c23.7-13.8,44-30.6,60.2-49.8C463.1,386.6,450.1,410.9,430.5,430.5
L430.5,430.5z M472.6,345.1c-14.6,20-33.8,37.7-56.6,52.4c10.7-20.8,18.8-42.8,24.3-65.6c12.3-20,22.2-41.3,29.5-63.7
C475.4,294.7,476.5,320.8,472.6,345.1L472.6,345.1z M473.5,255.3c2.6-9.9,4.7-20,6.1-30.1c2.2-15.7,2.7-31.7,1.4-47.5
c14.2,23.6,22.2,49.8,22.2,77.4s-8.1,54.1-22.4,77.8C482.9,307.9,480.5,281.6,473.5,255.3L473.5,255.3z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

+1 -1
View File
@@ -27,7 +27,7 @@ See the [Build from Source](https://github.com/spring-projects/spring-framework/
## Continuous Integration Builds
Information regarding CI builds can be found in the [Spring Framework Concourse pipeline](ci/README.adoc) documentation.
CI builds are defined with [GitHub Actions workflows](.github/workflows).
## Stay in Touch
+6 -15
View File
@@ -9,7 +9,7 @@ plugins {
id 'io.github.goooler.shadow' version '8.1.8' apply false
id 'me.champeau.jmh' version '0.7.2' apply false
id 'me.champeau.mrjar' version '0.1.1'
id "net.ltgt.errorprone" version "3.1.0" apply false
id "net.ltgt.errorprone" version "4.1.0" apply false
}
ext {
@@ -68,17 +68,13 @@ configure([rootProject] + javaProjects) { project ->
apply from: "${rootDir}/gradle/ide.gradle"
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("org.junit.platform:junit-platform-suite-api")
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.platform:junit-platform-suite")
testImplementation("org.mockito:mockito-core")
testImplementation("org.mockito:mockito-junit-jupiter")
testImplementation("io.mockk:mockk")
testImplementation("org.assertj:assertj-core")
// Pull in the latest JUnit 5 Launcher API to ensure proper support in IDEs.
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly("org.junit.platform:junit-platform-suite-engine")
testRuntimeOnly("org.apache.logging.log4j:log4j-core")
testRuntimeOnly("org.apache.logging.log4j:log4j-jul")
testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j2-impl")
@@ -90,20 +86,15 @@ configure([rootProject] + javaProjects) { project ->
ext.javadocLinks = [
"https://docs.oracle.com/en/java/javase/17/docs/api/",
"https://jakarta.ee/specifications/platform/9/apidocs/",
"https://docs.jboss.org/hibernate/orm/5.6/javadocs/",
"https://eclipse.dev/aspectj/doc/latest/runtime-api/",
"https://docs.hibernate.org/orm/5.6/javadocs/",
"https://www.quartz-scheduler.org/api/2.3.0/",
"https://fasterxml.github.io/jackson-core/javadoc/2.14/",
"https://fasterxml.github.io/jackson-databind/javadoc/2.14/",
"https://fasterxml.github.io/jackson-dataformat-xml/javadoc/2.14/",
"https://hc.apache.org/httpcomponents-client-5.4.x/current/httpclient5/apidocs/",
//"https://hc.apache.org/httpcomponents-client-5.5.x/current/httpclient5/apidocs/",
"https://projectreactor.io/docs/test/release/api/",
"https://junit.org/junit4/javadoc/4.13.2/",
// TODO Uncomment link to JUnit 5 docs once we execute Gradle with Java 18+.
// See https://github.com/spring-projects/spring-framework/issues/27497
//
// "https://junit.org/junit5/docs/5.11.4/api/",
"https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/",
"https://www.reactive-streams.org/reactive-streams-1.0.4-javadoc/",
//"https://javadoc.io/static/io.rsocket/rsocket-core/1.1.1/",
"https://r2dbc.io/spec/1.0.0.RELEASE/api/",
// Previously there could be a split-package issue between JSR250 and JSR305 javax.annotation packages,
+1 -1
View File
@@ -6,7 +6,7 @@
<module name="io.spring.javaformat.checkstyle.check.SpringHeaderCheck">
<property name="fileExtensions" value="java"/>
<property name="headerType" value="apache2"/>
<property name="headerCopyrightPattern" value="20\d\d-20\d\d"/>
<property name="headerCopyrightPattern" value="20\d\d-present"/>
<property name="packageInfoHeaderType" value="none"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck"/>
+1 -1
View File
@@ -1,2 +1,2 @@
org.gradle.caching=true
javaFormatVersion=0.0.42
javaFormatVersion=0.0.43
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2025 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@ public class CheckstyleConventions {
project.getPlugins().apply(CheckstylePlugin.class);
project.getTasks().withType(Checkstyle.class).forEach(checkstyle -> checkstyle.getMaxHeapSize().set("1g"));
CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);
checkstyle.setToolVersion("10.21.2");
checkstyle.setToolVersion("10.26.1");
checkstyle.getConfigDirectory().set(project.getRootProject().file("src/checkstyle"));
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();
@@ -64,7 +64,7 @@ public class CheckstyleConventions {
NoHttpExtension noHttp = project.getExtensions().getByType(NoHttpExtension.class);
noHttp.setAllowlistFile(project.file("src/nohttp/allowlist.lines"));
noHttp.getSource().exclude("**/test-output/**", "**/.settings/**",
"**/.classpath", "**/.project", "**/.gradle/**", "**/node_modules/**");
"**/.classpath", "**/.project", "**/.gradle/**", "**/node_modules/**", "buildSrc/build/**");
List<String> buildFolders = List.of("bin", "build", "out");
project.allprojects(subproject -> {
Path rootPath = project.getRootDir().toPath();
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ import java.util.Map;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaBasePlugin;
import org.gradle.api.tasks.testing.Test;
import org.gradle.api.tasks.testing.TestFrameworkOptions;
import org.gradle.api.tasks.testing.junitplatform.JUnitPlatformOptions;
import org.gradle.testretry.TestRetryPlugin;
import org.gradle.testretry.TestRetryTaskExtension;
@@ -34,6 +36,7 @@ import org.gradle.testretry.TestRetryTaskExtension;
*
* @author Brian Clozel
* @author Andy Wilkinson
* @author Sam Brannen
*/
class TestConventions {
@@ -50,7 +53,12 @@ class TestConventions {
}
private void configureTests(Project project, Test test) {
test.useJUnitPlatform();
TestFrameworkOptions existingOptions = test.getOptions();
test.useJUnitPlatform(options -> {
if (existingOptions instanceof JUnitPlatformOptions junitPlatformOptions) {
options.copyFrom(junitPlatformOptions);
}
});
test.include("**/*Tests.class", "**/*Test.class");
test.setSystemProperties(Map.of(
"java.awt.headless", "true",
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+5 -3
View File
@@ -1,6 +1,6 @@
plugins {
id 'java-platform'
id 'io.freefair.aggregate-javadoc' version '8.3'
id 'io.freefair.aggregate-javadoc' version '8.13.1'
}
description = "Spring Framework API Docs"
@@ -21,6 +21,7 @@ dependencies {
javadoc {
title = "${rootProject.description} ${version} API"
failOnError = true
options {
encoding = "UTF-8"
memberLevel = JavadocMemberLevel.PROTECTED
@@ -31,8 +32,9 @@ javadoc {
destinationDir = project.java.docsDir.dir("javadoc-api").get().asFile
splitIndex = true
links(rootProject.ext.javadocLinks)
addBooleanOption('Xdoclint:syntax,reference', true) // only check syntax and reference with doclint
addBooleanOption('Werror', true) // fail build on Javadoc warnings
// Check for 'syntax' and 'reference' during linting.
addBooleanOption('Xdoclint:syntax,reference', true)
addBooleanOption('Werror', true) // fail build on Javadoc warnings
}
maxMemory = "1024m"
doFirst {
+5 -3
View File
@@ -13,8 +13,10 @@ content:
- url: https://github.com/spring-projects/spring-framework
# Refname matching:
# https://docs.antora.org/antora/latest/playbook/content-refname-matching/
branches: ['main', '{6..9}.+({1..9}).x']
tags: ['v{6..9}.+({0..9}).+({0..9})?(-{RC,M}*)', '!(v6.0.{0..8})', '!(v6.0.0-{RC,M}{0..9})']
# branches: We include snapshots for main, 6.2.x, and 7.0.x to 9.*.x.
branches: ['main', '6.2.x', '{7..9}.+({0..9}).x']
# tags: include all releases from 6.2.0 to 9.*.*.
tags: ['v6.2.+({0..9})', 'v{7..9}.+({0..9}).+({0..9})?(-{RC,M}*)']
start_path: framework-docs
asciidoc:
extensions:
@@ -36,4 +38,4 @@ runtime:
failure_level: warn
ui:
bundle:
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.18/ui-bundle.zip
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.26/ui-bundle.zip
+1 -1
View File
@@ -6,7 +6,7 @@ nav:
ext:
collector:
run:
command: gradlew -q -PbuildSrc.skipTests=true "-Dorg.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError" :framework-docs:generateAntoraResources
command: gradlew -q -PbuildSrc.skipTests=true "-Dorg.gradle.jvmargs=-Xmx3g" :framework-docs:generateAntoraResources
local: true
scan:
dir: ./build/generated-antora-resources
+28 -27
View File
@@ -42,33 +42,34 @@ repositories {
}
dependencies {
api(project(":spring-aspects"))
api(project(":spring-context"))
api(project(":spring-context-support"))
api(project(":spring-jdbc"))
api(project(":spring-jms"))
api(project(":spring-test"))
api(project(":spring-web"))
api(project(":spring-webflux"))
api(project(":spring-webmvc"))
api(project(":spring-websocket"))
api("com.fasterxml.jackson.core:jackson-databind")
api("com.fasterxml.jackson.module:jackson-module-parameter-names")
api("com.mchange:c3p0:0.9.5.5")
api("com.oracle.database.jdbc:ojdbc11")
api("io.projectreactor.netty:reactor-netty-http")
api("jakarta.jms:jakarta.jms-api")
api("jakarta.servlet:jakarta.servlet-api")
api("jakarta.resource:jakarta.resource-api")
api("jakarta.validation:jakarta.validation-api")
api("javax.cache:cache-api")
api("org.apache.activemq:activemq-ra:6.1.2")
api("org.apache.commons:commons-dbcp2:2.11.0")
api("org.aspectj:aspectjweaver")
api("org.eclipse.jetty.websocket:jetty-websocket-jetty-api")
api("org.jetbrains.kotlin:kotlin-stdlib")
implementation(project(":spring-aspects"))
implementation(project(":spring-context"))
implementation(project(":spring-context-support"))
implementation(project(":spring-core-test"))
implementation(project(":spring-jdbc"))
implementation(project(":spring-jms"))
implementation(project(":spring-test"))
implementation(project(":spring-web"))
implementation(project(":spring-webflux"))
implementation(project(":spring-webmvc"))
implementation(project(":spring-websocket"))
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("com.fasterxml.jackson.module:jackson-module-parameter-names")
implementation("com.mchange:c3p0:0.9.5.5")
implementation("com.oracle.database.jdbc:ojdbc11")
implementation("io.projectreactor.netty:reactor-netty-http")
implementation("jakarta.jms:jakarta.jms-api")
implementation("jakarta.servlet:jakarta.servlet-api")
implementation("jakarta.resource:jakarta.resource-api")
implementation("jakarta.validation:jakarta.validation-api")
implementation("jakarta.websocket:jakarta.websocket-client-api")
implementation("javax.cache:cache-api")
implementation("org.apache.activemq:activemq-ra:6.1.2")
implementation("org.apache.commons:commons-dbcp2:2.11.0")
implementation("org.aspectj:aspectjweaver")
implementation("org.assertj:assertj-core")
implementation("org.eclipse.jetty.websocket:jetty-websocket-jetty-api")
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("org.junit.jupiter:junit-jupiter-api")
}
+1 -1
View File
@@ -326,9 +326,9 @@
*** xref:testing/testcontext-framework/application-events.adoc[]
*** xref:testing/testcontext-framework/test-execution-events.adoc[]
*** xref:testing/testcontext-framework/ctx-management.adoc[]
**** xref:testing/testcontext-framework/ctx-management/javaconfig.adoc[]
**** xref:testing/testcontext-framework/ctx-management/xml.adoc[]
**** xref:testing/testcontext-framework/ctx-management/groovy.adoc[]
**** xref:testing/testcontext-framework/ctx-management/javaconfig.adoc[]
**** xref:testing/testcontext-framework/ctx-management/mixed-config.adoc[]
**** xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[]
**** xref:testing/testcontext-framework/ctx-management/initializers.adoc[]
@@ -92,11 +92,25 @@ the repeated JNDI lookup overhead. See
{spring-framework-api}++/jndi/JndiLocatorDelegate.html#IGNORE_JNDI_PROPERTY_NAME++[`JndiLocatorDelegate`]
for details.
| `spring.locking.strict`
| Instructs Spring to enforce strict locking during bean creation, rather than the mix of
strict and lenient locking that 6.2 applies by default. See
{spring-framework-api}++/beans/factory/support/DefaultListableBeanFactory.html#STRICT_LOCKING_PROPERTY_NAME++[`DefaultListableBeanFactory`]
for details.
| `spring.objenesis.ignore`
| Instructs Spring to ignore Objenesis, not even attempting to use it. See
{spring-framework-api}++/objenesis/SpringObjenesis.html#IGNORE_OBJENESIS_PROPERTY_NAME++[`SpringObjenesis`]
for details.
| `spring.placeholder.escapeCharacter.default`
| The default escape character for property placeholder support. If not set, `'\'` will
be used. Can be set to a custom escape character or an empty string to disable support
for an escape character. The default escape character be explicitly overridden in
`PropertySourcesPlaceholderConfigurer` and subclasses of `AbstractPropertyResolver`. See
{spring-framework-api}++/core/env/AbstractPropertyResolver.html#DEFAULT_PLACEHOLDER_ESCAPE_CHARACTER_PROPERTY_NAME++[`AbstractPropertyResolver`]
for details.
| `spring.test.aot.processing.failOnError`
| A boolean flag that controls whether errors encountered during AOT processing in the
_Spring TestContext Framework_ should result in an exception that fails the overall process.
@@ -17,14 +17,3 @@ is also provided.
AOT processing can be used to optimize your application ahead-of-time. It is typically
used for native image deployment using GraalVM.
@@ -6,7 +6,3 @@ The previous chapter described the Spring's support for AOP with @AspectJ and sc
aspect definitions. In this chapter, we discuss the lower-level Spring AOP APIs. For common
applications, we recommend the use of Spring AOP with AspectJ pointcuts as described in the
previous chapter.
@@ -4,7 +4,6 @@
Now we can examine how Spring AOP handles advice.
[[aop-api-advice-lifecycle]]
== Advice Lifecycles
@@ -22,14 +21,12 @@ the advice adds state to the proxied object.
You can use a mix of shared and per-instance advice in the same AOP proxy.
[[aop-api-advice-types]]
== Advice Types in Spring
Spring provides several advice types and is extensible to support
arbitrary advice types. This section describes the basic concepts and standard advice types.
[[aop-api-advice-around]]
=== Interception Around Advice
@@ -101,7 +98,6 @@ you are likely to want to run the aspect in another AOP framework. Note that poi
are not currently interoperable between frameworks, and the AOP Alliance does not
currently define pointcut interfaces.
[[aop-api-advice-before]]
=== Before Advice
@@ -168,7 +164,6 @@ Kotlin::
TIP: Before advice can be used with any pointcut.
[[aop-api-advice-throws]]
=== Throws Advice
@@ -297,7 +292,6 @@ exception that is incompatible with the target method's signature!_
TIP: Throws advice can be used with any pointcut.
[[aop-api-advice-after-returning]]
=== After Returning Advice
@@ -361,7 +355,6 @@ thrown up the interceptor chain instead of the return value.
TIP: After returning advice can be used with any pointcut.
[[aop-api-advice-introduction]]
=== Introduction Advice
@@ -501,7 +494,6 @@ Java::
}
return super.invoke(invocation);
}
}
----
@@ -531,7 +523,6 @@ Kotlin::
}
return super.invoke(invocation)
}
}
----
======
@@ -582,8 +573,3 @@ We can apply this advisor programmatically by using the `Advised.addAdvisor()` m
(the recommended way) in XML configuration, as any other advisor. All proxy creation
choices discussed below, including "`auto proxy creators,`" correctly handle introductions
and stateful mixins.
@@ -142,7 +142,3 @@ case, the `Advised` `isFrozen()` method returns `true`, and any attempts to modi
advice through addition or removal results in an `AopConfigException`. The ability
to freeze the state of an advised object is useful in some cases (for example, to
prevent calling code removing a security interceptor).
@@ -14,7 +14,3 @@ It is possible to mix advisor and advice types in Spring in the same AOP proxy.
example, you could use an interception around advice, throws advice, and before advice in
one proxy configuration. Spring automatically creates the necessary interceptor
chain.
@@ -19,14 +19,12 @@ There are two ways to do this:
auto-proxy creation driven by source-level metadata attributes.
[[aop-autoproxy-choices]]
== Auto-proxy Bean Definitions
This section covers the auto-proxy creators provided by the
`org.springframework.aop.framework.autoproxy` package.
[[aop-api-autoproxy]]
=== `BeanNameAutoProxyCreator`
@@ -61,7 +59,6 @@ automatically created by the `BeanNameAutoProxyCreator`. The same advice is appl
to all matching beans. Note that, if advisors are used (rather than the interceptor in
the preceding example), the pointcuts may apply differently to different beans.
[[aop-api-autoproxy-default]]
=== `DefaultAdvisorAutoProxyCreator`
@@ -125,7 +122,3 @@ differently configured, AdvisorAutoProxyCreators in the same factory) and orderi
Advisors can implement the `org.springframework.core.Ordered` interface to ensure
correct ordering if this is an issue. The `TransactionAttributeSourceAdvisor` used in the
preceding example has a configurable order value. The default setting is unordered.
@@ -65,7 +65,3 @@ that, if you have a (parent) bean definition that you intend to use only as a te
and this definition specifies a class, you must make sure to set the `abstract`
attribute to `true`. Otherwise, the application context actually tries to
pre-instantiate it.
@@ -14,7 +14,6 @@ the pointcuts, any advice that applies, and their ordering. However, there are s
options that are preferable if you do not need such control.
[[aop-pfb-1]]
== Basics
@@ -32,7 +31,6 @@ application objects (besides the target, which should be available in any AOP
framework), benefiting from all the pluggability provided by Dependency Injection.
[[aop-pfb-2]]
== JavaBean Properties
@@ -87,7 +85,6 @@ to be applied. You can find an example of using this feature in xref:core/aop-ap
`false`.
[[aop-pfb-proxy-types]]
== JDK- and CGLIB-based proxies
@@ -137,7 +134,6 @@ interface that the target class implements to the `proxyInterfaces` property. Ho
it is significantly less work and less prone to typographical errors.
[[aop-api-proxying-intf]]
== Proxying Interfaces
@@ -263,7 +259,6 @@ However, there are times when being able to obtain the un-advised target from th
factory might actually be an advantage (for example, in certain test scenarios).
[[aop-api-proxying-class]]
== Proxying Classes
@@ -302,7 +297,6 @@ There is little performance difference between CGLIB proxies and dynamic proxies
Performance should not be a decisive consideration in this case.
[[aop-global-advisors]]
== Using "`Global`" Advisors
@@ -325,7 +319,3 @@ two global advisors:
<bean id="global_debug" class="org.springframework.aop.interceptor.DebugInterceptor"/>
<bean id="global_performance" class="org.springframework.aop.interceptor.PerformanceMonitorInterceptor"/>
----
@@ -4,7 +4,6 @@
This section describes how Spring handles the crucial pointcut concept.
[[aop-api-concepts]]
== Concepts
@@ -69,7 +68,6 @@ TIP: If possible, try to make pointcuts static, allowing the AOP framework to ca
results of pointcut evaluation when an AOP proxy is created.
[[aop-api-pointcut-ops]]
== Operations on Pointcuts
@@ -84,7 +82,6 @@ You can compose pointcuts by using the static methods in the
expressions is usually a simpler approach.
[[aop-api-pointcuts-aspectj]]
== AspectJ Expression Pointcuts
@@ -95,14 +92,12 @@ uses an AspectJ-supplied library to parse an AspectJ pointcut expression string.
See the xref:core/aop.adoc[previous chapter] for a discussion of supported AspectJ pointcut primitives.
[[aop-api-pointcuts-impls]]
== Convenience Pointcut Implementations
Spring provides several convenient pointcut implementations. You can use some of them
directly; others are intended to be subclassed in application-specific pointcuts.
[[aop-api-pointcuts-static]]
=== Static Pointcuts
@@ -146,7 +141,6 @@ You can use `RegexpMethodPointcutAdvisor` with any `Advice` type.
An important type of static pointcut is a metadata-driven pointcut. This uses the
values of metadata attributes (typically, source-level metadata).
[[aop-api-pointcuts-dynamic]]
=== Dynamic pointcuts
@@ -172,7 +166,6 @@ other dynamic pointcuts. In Java 1.4, the cost is about five times that of other
pointcuts.
[[aop-api-pointcuts-superclasses]]
== Pointcut Superclasses
@@ -214,7 +207,6 @@ There are also superclasses for dynamic pointcuts.
You can use custom pointcuts with any advice type.
[[aop-api-pointcuts-custom]]
== Custom Pointcuts
@@ -225,7 +217,3 @@ expression language, if you can.
NOTE: Later versions of Spring may offer support for "`semantic pointcuts`" as offered by JAC --
for example, "`all methods that change instance variables in the target object.`"
@@ -22,7 +22,6 @@ rather than a singleton bean definition. This allows Spring to create a new targ
instance when required.
[[aop-ts-swap]]
== Hot-swappable Target Sources
@@ -77,7 +76,6 @@ use a `TargetSource`), any `TargetSource` can be used in conjunction with
arbitrary advice.
[[aop-ts-pool]]
== Pooling Target Sources
@@ -175,7 +173,6 @@ Simpler pooling is available by using auto-proxying. You can set the `TargetSour
used by any auto-proxy creator.
[[aop-ts-prototype]]
== Prototype Target Sources
@@ -200,7 +197,6 @@ The only property is the name of the target bean. Inheritance is used in the
source, the target bean must be a prototype bean definition.
[[aop-ts-threadlocal]]
== `ThreadLocal` Target Sources
@@ -226,7 +222,3 @@ always remember to correctly set and unset (where the latter involves a call to
any case, since not unsetting it might result in problematic behavior. Spring's
`ThreadLocal` support does this for you and should always be considered in favor of using
`ThreadLocal` instances without other proper handling code.
@@ -32,7 +32,3 @@ AOP is used in the Spring Framework to:
NOTE: If you are interested only in generic declarative services or other pre-packaged
declarative middleware services such as pooling, you do not need to work directly with
Spring AOP, and can skip most of this chapter.
@@ -53,7 +53,3 @@ Kotlin::
======
See the {spring-framework-api}/aop/aspectj/annotation/AspectJProxyFactory.html[javadoc] for more information.
@@ -11,6 +11,3 @@ there is no dependency on the AspectJ compiler or weaver.
NOTE: Using the AspectJ compiler and weaver enables use of the full AspectJ language and
is discussed in xref:core/aop/using-aspectj.adoc[Using AspectJ with Spring Applications].
@@ -937,5 +937,3 @@ reflection for javac-compiled classes). Consider collapsing such advice methods
advice method per join point in each `@Aspect` class or refactor the pieces of advice into
separate `@Aspect` classes that you can order at the aspect level via `Ordered` or `@Order`.
====
@@ -32,6 +32,3 @@ stereotype annotation that qualifies, as per the rules of Spring's component sca
NOTE: In Spring AOP, aspects themselves cannot be the targets of advice from other
aspects. The `@Aspect` annotation on a class marks it as an aspect and, hence, excludes
it from auto-proxying.
@@ -18,7 +18,8 @@ call `proceed` multiple times. The following listing shows the basic aspect impl
include-code::./ConcurrentOperationExecutor[tag=snippet,indent=0]
`@Around("com.xyz.CommonPointcuts.businessService()")` references the `businessService` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-common-pointcuts[Sharing Named Pointcut Definitions].
`@Around("com.xyz.CommonPointcuts.businessService()")` references the `businessService` named pointcut defined in
xref:core/aop/ataspectj/pointcuts.adoc#aop-common-pointcuts[Sharing Named Pointcut Definitions].
Note that the aspect implements the `Ordered` interface so that we can set the precedence of
the aspect higher than the transaction advice (we want a fresh transaction each time we
@@ -60,6 +60,3 @@ Programming Guide for more information on `per` clauses.
The `pertarget` instantiation model works in exactly the same way as `perthis`, but it
creates one aspect instance for each unique target object at matched join points.
@@ -75,5 +75,3 @@ Kotlin::
val usageTracked = context.getBean<UsageTracked>("myService")
----
======
@@ -104,7 +104,7 @@ Note that pointcut definitions are generally matched against any intercepted met
If a pointcut is strictly meant to be public-only, even in a CGLIB proxy scenario with
potential non-public interactions through proxies, it needs to be defined accordingly.
If your interception needs include method calls or even constructors within the target
If your interception needs to include method calls or even constructors within the target
class, consider the use of Spring-driven xref:core/aop/using-aspectj.adoc#aop-aj-ltw[native AspectJ weaving] instead
of Spring's proxy-based AOP framework. This constitutes a different mode of AOP usage
with different characteristics, so be sure to make yourself familiar with weaving
@@ -581,6 +581,3 @@ performance (time and memory used), due to extra processing and analysis. Scopin
designators are very fast to match, and using them means AspectJ can very quickly
dismiss groups of join points that should not be further processed. A good
pointcut should always include one if possible.
@@ -8,7 +8,6 @@ decisions are influenced by a number of factors including application requiremen
development tools, and team familiarity with AOP.
[[aop-spring-or-aspectj]]
== Spring AOP or Full AspectJ?
@@ -31,7 +30,6 @@ the @AspectJ style, sticking with regular Java compilation in your IDE, and addi
an aspect weaving phase to your build script.
[[aop-ataspectj-or-xml]]
== @AspectJ or XML for Spring AOP?
@@ -107,7 +105,3 @@ Spring AOP and by AspectJ. So, if you later decide you need the capabilities of
to implement additional requirements, you can easily migrate to a classic AspectJ setup.
In general, the Spring team prefers the @AspectJ style for custom aspects beyond simple
configuration of enterprise services.
@@ -73,7 +73,3 @@ it from older technologies offering only interception. Pointcuts enable advice t
targeted independently of the object-oriented hierarchy. For example, you can apply an
around advice providing declarative transaction management to a set of methods that span
multiple objects (such as all business operations in the service layer).
@@ -14,9 +14,5 @@ need to advise a method that is not declared on an interface or where you need t
pass a proxied object to a method as a concrete type.
It is important to grasp the fact that Spring AOP is proxy-based. See
xref:core/aop/proxying.adoc#aop-understanding-aop-proxies[Understanding AOP Proxies] for a thorough examination of exactly what this
implementation detail actually means.
xref:core/aop/proxying.adoc#aop-understanding-aop-proxies[Understanding AOP Proxies]
for a thorough examination of exactly what this implementation detail actually means.
@@ -52,10 +52,6 @@ configuration-style approach. The fact that this chapter chooses to introduce th
@AspectJ-style approach first should not be taken as an indication that the Spring team
favors the @AspectJ annotation-style approach over the Spring XML configuration-style.
See xref:core/aop/choosing.adoc[Choosing which AOP Declaration Style to Use] for a more complete discussion of the advantages and disadvantages of
each style.
See xref:core/aop/choosing.adoc[Choosing which AOP Declaration Style to Use] for a more
complete discussion of the advantages and disadvantages of each style.
====
@@ -6,7 +6,3 @@ It is perfectly possible to mix @AspectJ style aspects by using the auto-proxyin
schema-defined `<aop:aspect>` aspects, `<aop:advisor>` declared advisors, and even proxies
and interceptors in other styles in the same configuration. All of these are implemented
by using the same underlying support mechanism and can co-exist without any difficulty.
@@ -61,7 +61,6 @@ proxies _for all three of them_.
====
[[aop-understanding-aop-proxies]]
== Understanding AOP Proxies
@@ -291,4 +290,3 @@ Kotlin::
NOTE: AspectJ compile-time weaving and load-time weaving do not have this self-invocation
issue because they apply advice within the bytecode instead of via a proxy.
@@ -26,7 +26,6 @@ use either only the `<aop:config>` style or only the `AutoProxyCreator` style an
never mix them.
[[aop-schema-declaring-an-aspect]]
== Declaring an Aspect
@@ -54,7 +53,6 @@ The bean that backs the aspect (`aBean` in this case) can of course be configure
dependency injected just like any other Spring bean.
[[aop-schema-pointcuts]]
== Declaring a Pointcut
@@ -177,9 +175,7 @@ follows:
Note that pointcuts defined in this way are referred to by their XML `id` and cannot be
used as named pointcuts to form composite pointcuts. The named pointcut support in the
schema-based definition style is thus more limited than that offered by the @AspectJ
style.
schema-based definition style is thus more limited than that offered by the @AspectJ style.
[[aop-schema-advice]]
@@ -188,7 +184,6 @@ style.
The schema-based AOP support uses the same five kinds of advice as the @AspectJ style, and they have
exactly the same semantics.
[[aop-schema-advice-before]]
=== Before Advice
@@ -237,7 +232,6 @@ that contains the advice. Before a data access operation is performed (a method
join point matched by the pointcut expression), the `doAccessCheck` method on the aspect
bean is invoked.
[[aop-schema-advice-after-returning]]
=== After Returning Advice
@@ -295,7 +289,6 @@ Kotlin::
----
======
[[aop-schema-advice-after-throwing]]
=== After Throwing Advice
@@ -353,7 +346,6 @@ Kotlin::
----
======
[[aop-schema-advice-after-finally]]
=== After (Finally) Advice
@@ -372,7 +364,6 @@ You can declare it by using the `after` element, as the following example shows:
</aop:aspect>
----
[[aop-schema-advice-around]]
=== Around Advice
@@ -444,17 +435,18 @@ Kotlin::
----
======
[[aop-schema-params]]
=== Advice Parameters
The schema-based declaration style supports fully typed advice in the same way as
described for the @AspectJ support -- by matching pointcut parameters by name against
advice method parameters. See xref:core/aop/ataspectj/advice.adoc#aop-ataspectj-advice-params[Advice Parameters] for details. If you wish
to explicitly specify argument names for the advice methods (not relying on the
advice method parameters. See
xref:core/aop/ataspectj/advice.adoc#aop-ataspectj-advice-params[Advice Parameters] for details.
If you wish to explicitly specify argument names for the advice methods (not relying on the
detection strategies previously described), you can do so by using the `arg-names`
attribute of the advice element, which is treated in the same manner as the `argNames`
attribute in an advice annotation (as described in xref:core/aop/ataspectj/advice.adoc#aop-ataspectj-advice-params-names[Determining Argument Names]).
attribute in an advice annotation (as described in
xref:core/aop/ataspectj/advice.adoc#aop-ataspectj-advice-params-names[Determining Argument Names]).
The following example shows how to specify an argument name in XML:
[source,xml,indent=0,subs="verbatim"]
@@ -464,7 +456,8 @@ The following example shows how to specify an argument name in XML:
method="audit"
arg-names="auditable" />
----
<1> References the `publicMethod` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].
<1> References the `publicMethod` named pointcut defined in
xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].
The `arg-names` attribute accepts a comma-delimited list of parameter names.
@@ -645,15 +638,15 @@ ms % Task name
00000 ? execution(getFoo)
----
[[aop-ordering]]
=== Advice Ordering
When multiple pieces of advice need to run at the same join point (executing method)
the ordering rules are as described in xref:core/aop/ataspectj/advice.adoc#aop-ataspectj-advice-ordering[Advice Ordering]. The precedence
between aspects is determined via the `order` attribute in the `<aop:aspect>` element or
by either adding the `@Order` annotation to the bean that backs the aspect or by having
the bean implement the `Ordered` interface.
the ordering rules are as described in
xref:core/aop/ataspectj/advice.adoc#aop-ataspectj-advice-ordering[Advice Ordering]. The
precedence between aspects is determined via the `order` attribute in the `<aop:aspect>`
element or by either adding the `@Order` annotation to the bean that backs the aspect
or by having the bean implement the `Ordered` interface.
[NOTE]
====
@@ -676,7 +669,6 @@ at the aspect level.
====
[[aop-schema-introductions]]
== Introductions
@@ -756,7 +748,6 @@ Kotlin::
======
[[aop-schema-instantiation-models]]
== Aspect Instantiation Models
@@ -764,7 +755,6 @@ The only supported instantiation model for schema-defined aspects is the singlet
model. Other instantiation models may be supported in future releases.
[[aop-schema-advisors]]
== Advisors
@@ -772,7 +762,8 @@ The concept of "advisors" comes from the AOP support defined in Spring
and does not have a direct equivalent in AspectJ. An advisor is like a small
self-contained aspect that has a single piece of advice. The advice itself is
represented by a bean and must implement one of the advice interfaces described in
xref:core/aop-api/advice.adoc#aop-api-advice-types[Advice Types in Spring]. Advisors can take advantage of AspectJ pointcut expressions.
xref:core/aop-api/advice.adoc#aop-api-advice-types[Advice Types in Spring].
Advisors can take advantage of AspectJ pointcut expressions.
Spring supports the advisor concept with the `<aop:advisor>` element. You most
commonly see it used in conjunction with transactional advice, which also has its own
@@ -805,7 +796,6 @@ To define the precedence of an advisor so that the advice can participate in ord
use the `order` attribute to define the `Ordered` value of the advisor.
[[aop-schema-example]]
== An AOP Schema Example
@@ -981,7 +971,3 @@ pointcut expression so that only `@Idempotent` operations match, as follows:
expression="execution(* com.xyz.service.*.*(..)) and
@annotation(com.xyz.service.Idempotent)"/>
----
@@ -8,12 +8,14 @@ alone.
Spring ships with a small AspectJ aspect library, which is available stand-alone in your
distribution as `spring-aspects.jar`. You need to add this to your classpath in order
to use the aspects in it. xref:core/aop/using-aspectj.adoc#aop-atconfigurable[Using AspectJ to Dependency Inject Domain Objects with Spring] and xref:core/aop/using-aspectj.adoc#aop-ajlib-other[Other Spring aspects for AspectJ] discuss the
content of this library and how you can use it. xref:core/aop/using-aspectj.adoc#aop-aj-configure[Configuring AspectJ Aspects by Using Spring IoC] discusses how to
dependency inject AspectJ aspects that are woven using the AspectJ compiler. Finally,
xref:core/aop/using-aspectj.adoc#aop-aj-ltw[Load-time Weaving with AspectJ in the Spring Framework] provides an introduction to load-time weaving for Spring applications
that use AspectJ.
to use the aspects in it.
xref:core/aop/using-aspectj.adoc#aop-atconfigurable[Using AspectJ to Dependency Inject Domain Objects with Spring]
and xref:core/aop/using-aspectj.adoc#aop-ajlib-other[Other Spring aspects for AspectJ]
discuss the content of this library and how you can use it.
xref:core/aop/using-aspectj.adoc#aop-aj-configure[Configuring AspectJ Aspects by Using Spring IoC]
discusses how to dependency inject AspectJ aspects that are woven using the AspectJ compiler. Finally,
xref:core/aop/using-aspectj.adoc#aop-aj-ltw[Load-time Weaving with AspectJ in the Spring Framework]
provides an introduction to load-time weaving for Spring applications that use AspectJ.
[[aop-atconfigurable]]
@@ -206,7 +208,6 @@ not use `@Configurable` on bean classes that are registered as regular Spring be
with the container. Doing so results in double initialization, once through the
container and once through the aspect.
[[aop-configurable-testing]]
=== Unit Testing `@Configurable` Objects
@@ -219,7 +220,6 @@ you can still unit test outside of the container as normal, but you see a warnin
message each time that you construct a `@Configurable` object indicating that it has
not been configured by Spring.
[[aop-configurable-container]]
=== Working with Multiple Application Contexts
@@ -249,7 +249,6 @@ is added only to the container-wide classpath (and hence loaded by the shared pa
not what you want).
[[aop-ajlib-other]]
== Other Spring aspects for AspectJ
@@ -302,7 +301,6 @@ fully qualified class names:
----
[[aop-aj-configure]]
== Configuring AspectJ Aspects by Using Spring IoC
@@ -357,7 +355,6 @@ results in the creation of Spring AOP proxies. The @AspectJ style of aspect
declaration is being used here, but the AspectJ runtime is not involved.
[[aop-aj-ltw]]
== Load-time Weaving with AspectJ in the Spring Framework
@@ -391,7 +388,6 @@ LTW that uses Spring, followed by detailed specifics about elements introduced i
example. For a complete example, see the
{petclinic-github-org}/spring-framework-petclinic[Petclinic sample application based on Spring Framework].
[[aop-aj-ltw-first-example]]
=== A First Example
@@ -677,7 +673,6 @@ nice example of a development-time aspect that developers can use during develop
and then easily exclude from builds of the application being deployed
into UAT or production.
[[aop-aj-ltw-the-aspects]]
=== Aspects
@@ -686,7 +681,6 @@ either the AspectJ language itself, or you can write your aspects in the @Aspect
Your aspects are then both valid AspectJ and Spring AOP aspects.
Furthermore, the compiled aspect classes need to be available on the classpath.
[[aop-aj-ltw-aop_dot_xml]]
=== `META-INF/aop.xml`
@@ -716,7 +710,6 @@ The structure and contents of this file is detailed in the LTW part of the
{aspectj-docs-devguide}/ltw-configuration.html[AspectJ reference
documentation]. Because the `aop.xml` file is 100% AspectJ, we do not describe it further here.
[[aop-aj-ltw-libraries]]
=== Required libraries (JARS)
@@ -731,7 +724,6 @@ If you use the xref:core/aop/using-aspectj.adoc#aop-aj-ltw-environments-generic[
* `spring-instrument.jar`
[[aop-aj-ltw-spring]]
=== Spring Configuration
@@ -831,7 +823,6 @@ possible values:
then AspectJ weaving is on. Otherwise, it is off. This is the default value.
|===
[[aop-aj-ltw-environments]]
=== Environment-specific Configuration
@@ -880,7 +871,3 @@ Note that this requires modification of the JVM launch script, which may prevent
from using this in application server environments (depending on your server and your
operation policies). That said, for one-app-per-JVM deployments such as standalone
Spring Boot applications, you typically control the entire JVM setup in any case.
+110 -47
View File
@@ -5,6 +5,7 @@ This chapter covers Spring's Ahead of Time (AOT) optimizations.
For AOT support specific to integration tests, see xref:testing/testcontext-framework/aot.adoc[Ahead of Time Support for Tests].
[[aot.introduction]]
== Introduction to Ahead of Time Optimizations
@@ -17,9 +18,9 @@ Applying such optimizations early implies the following restrictions:
* The beans defined in your application cannot change at runtime, meaning:
** `@Profile`, in particular profile-specific configuration, needs to be chosen at build time and is automatically enabled at runtime when AOT is enabled.
** `Environment` properties that impact the presence of a bean (`@Conditional`) are only considered at build time.
* Bean definitions with instance suppliers (lambdas or method references) cannot be transformed ahead-of-time.
* Bean definitions with instance suppliers (lambdas or method references) cannot be transformed ahead of time.
* Beans registered as singletons (using `registerSingleton`, typically from
`ConfigurableListableBeanFactory`) cannot be transformed ahead-of-time either.
`ConfigurableListableBeanFactory`) cannot be transformed ahead of time either.
* As we cannot rely on the instance, make sure that the bean type is as precise as
possible.
@@ -35,6 +36,7 @@ A Spring AOT processed application typically generates:
NOTE: At the moment, AOT is focused on allowing Spring applications to be deployed as native images using GraalVM.
We intend to support more JVM-based use cases in future generations.
[[aot.basics]]
== AOT Engine Overview
@@ -51,6 +53,7 @@ The `RuntimeHints` instance can also be used to generate the relevant GraalVM na
Those steps are covered in greater detail in the sections below.
[[aot.refresh]]
== Refresh for AOT Processing
@@ -88,6 +91,7 @@ This makes sure to create any proxy that will be required at runtime.
Once this part completes, the `BeanFactory` contains the bean definitions that are necessary for the application to run. It does not trigger bean instantiation but allows the AOT engine to inspect the beans that will be created at runtime.
[[aot.bean-factory-initialization-contributions]]
== Bean Factory Initialization AOT Contributions
@@ -106,11 +110,10 @@ Consequently, such a bean is automatically excluded from the AOT-optimized conte
[NOTE]
====
If a bean implements the `BeanFactoryInitializationAotProcessor` interface, the bean and **all** of its dependencies will be initialized during AOT processing.
We generally recommend that this interface is only implemented by infrastructure beans such as `BeanFactoryPostProcessor` which have limited dependencies and are already initialized early in the bean factory lifecycle.
We generally recommend that this interface is only implemented by infrastructure beans, such as a `BeanFactoryPostProcessor`, which have limited dependencies and are already initialized early in the bean factory lifecycle.
If such a bean is registered using an `@Bean` factory method, ensure the method is `static` so that its enclosing `@Configuration` class does not have to be initialized.
====
[[aot.bean-registration-contributions]]
=== Bean Registration AOT Contributions
@@ -127,7 +130,7 @@ Typically used when the bean definition needs to be tuned for specific features
[NOTE]
====
If a bean implements the `BeanRegistrationAotProcessor` interface, the bean and **all** of its dependencies will be initialized during AOT processing.
We generally recommend that this interface is only implemented by infrastructure beans such as `BeanFactoryPostProcessor` which have limited dependencies and are already initialized early in the bean factory lifecycle.
We generally recommend that this interface is only implemented by infrastructure beans, such as a `BeanFactoryPostProcessor`, which have limited dependencies and are already initialized early in the bean factory lifecycle.
If such a bean is registered using an `@Bean` factory method, ensure the method is `static` so that its enclosing `@Configuration` class does not have to be initialized.
====
@@ -219,21 +222,23 @@ NOTE: The exact code generated may differ depending on the exact nature of your
TIP: Each generated class is annotated with `org.springframework.aot.generate.Generated` to
identify them if they need to be excluded, for instance by static analysis tools.
The generated code above creates bean definitions equivalent to the `@Configuration` class, but in a direct way and without the use of reflection if at all possible.
The generated code above creates bean definitions equivalent to the `@Configuration` class, but in a direct way and without the use of reflection at all if possible.
There is a bean definition for `dataSourceConfiguration` and one for `dataSourceBean`.
When a `datasource` instance is required, a `BeanInstanceSupplier` is called.
This supplier invokes the `dataSource()` method on the `dataSourceConfiguration` bean.
[[aot.running]]
== Running with AOT Optimizations
AOT is a mandatory step to transform a Spring application to a native executable, so it
is automatically enabled when running in this mode. It is possible to use those optimizations
is automatically enabled when running within a native image. However it is also possible to use AOT optimizations
on the JVM by setting the `spring.aot.enabled` System property to `true`.
NOTE: When AOT optimizations are included, some decisions that have been taken at build-time
are hard-coded in the application setup. For instance, profiles that have been enabled at
build-time are automatically enabled at runtime as well.
NOTE: When AOT optimizations are included, some decisions that have been made at build time
are hard coded in the application setup. For instance, profiles that have been enabled at
build time are automatically enabled at runtime as well.
[[aot.bestpractices]]
== Best Practices
@@ -271,7 +276,7 @@ build time.
While your application may interact with an interface that a bean implements, it is still very important to declare the most precise type.
The AOT engine performs additional checks on the bean type, such as detecting the presence of `@Autowired` members or lifecycle callback methods.
For `@Configuration` classes, make sure that the return type of the factory `@Bean` method is as precise as possible.
For `@Configuration` classes, make sure that the return type of an `@Bean` factory method is as precise as possible.
Consider the following example:
[tabs]
@@ -305,11 +310,11 @@ Kotlin::
----
======
In the example above, the declared type for the `myInterface` bean is `MyInterface`.
None of the usual post-processing will take `MyImplementation` into account.
For instance, if there is an annotated handler method on `MyImplementation` that the context should register, it wont be detected upfront.
In the example above, the declared type for the `myInterface` bean is `MyInterface`.
During AOT processing, none of the usual post-processing will take `MyImplementation` into account.
For instance, if there is an annotated handler method on `MyImplementation` that the context should register, it will not be detected during AOT processing.
The example above should be rewritten as follows:
The example above should therefore be rewritten as follows:
[tabs]
======
@@ -348,7 +353,7 @@ If you are registering bean definitions programmatically, consider using `RootBe
=== Avoid Multiple Constructors
The container is able to choose the most appropriate constructor to use based on several candidates.
However, this is not a best practice and flagging the preferred constructor with `@Autowired` if necessary is preferred.
However, relying on that is not a best practice, and flagging the preferred constructor with `@Autowired` if necessary is preferred.
In case you are working on a code base that you cannot modify, you can set the {spring-framework-api}/beans/factory/support/AbstractBeanDefinition.html#PREFERRED_CONSTRUCTORS_ATTRIBUTE[`preferredConstructors` attribute] on the related bean definition to indicate which constructor should be used.
@@ -363,17 +368,17 @@ A good rule of thumb is to keep in mind that bean definitions are an abstraction
Rather than using such structures, decomposing to simple types or referring to a bean that is built as such is recommended.
As a last resort, you can implement your own `org.springframework.aot.generate.ValueCodeGenerator$Delegate`.
To use it, register its fully qualified name in `META-INF/spring/aot.factories` using the `Delegate` as the key.
To use it, register its fully-qualified name in `META-INF/spring/aot.factories` using `org.springframework.aot.generate.ValueCodeGenerator$Delegate` as the key.
[[aot.bestpractices.custom-arguments]]
=== Avoid Creating Beans with Custom Arguments
Spring AOT detects what needs to be done to create a bean and translates that in generated code using an instance supplier.
The container also supports creating a bean with {spring-framework-api}++/beans/factory/BeanFactory.html#getBean(java.lang.String,java.lang.Object...)++[custom arguments] that leads to several issues with AOT:
Spring AOT detects what needs to be done to create a bean and translates that into generated code that uses an instance supplier.
The container also supports creating a bean with {spring-framework-api}++/beans/factory/BeanFactory.html#getBean(java.lang.String,java.lang.Object...)++[custom arguments] which can lead to several issues with AOT:
. The custom arguments require dynamic introspection of a matching constructor or factory method.
Those arguments cannot be detected by AOT, so the necessary reflection hints will have to be provided manually.
. By-passing the instance supplier means that all other optimizations after creation are skipped as well.
. Bypassing the instance supplier means that all other optimizations after creation are skipped as well.
For instance, autowiring on fields and methods will be skipped as they are handled in the instance supplier.
Rather than having prototype-scoped beans created with custom arguments, we recommend a manual factory pattern where a bean is responsible for the creation of the instance.
@@ -396,7 +401,7 @@ for further information.
=== FactoryBean
`FactoryBean` should be used with care as it introduces an intermediate layer in terms of bean type resolution that may not be conceptually necessary.
As a rule of thumb, if the `FactoryBean` instance does not hold long-term state and is not needed at a later point in time at runtime, it should be replaced by a regular factory method, possibly with a `FactoryBean` adapter layer on top (for declarative configuration purposes).
As a rule of thumb, if a `FactoryBean` instance does not hold long-term state and is not needed at a later point at runtime, it should be replaced by a regular `@Bean` factory method, possibly with a `FactoryBean` adapter layer on top (for declarative configuration purposes).
If your `FactoryBean` implementation does not resolve the object type (i.e. `T`), extra care is necessary.
Consider the following example:
@@ -455,7 +460,7 @@ Kotlin::
----
======
If the `FactoryBean` bean definition is registered programmatically, make sure to follow these steps:
If a `FactoryBean` bean definition is registered programmatically, make sure to follow these steps:
1. Use `RootBeanDefinition`.
2. Set the `beanClass` to the `FactoryBean` class so that AOT knows that it is an intermediate layer.
@@ -469,20 +474,20 @@ Java::
+
[source,java,indent=0,subs="verbatim,quotes"]
----
RootBeanDefinition beanDefinition = new RootBeanDefinition(ClientFactoryBean.class);
beanDefinition.setTargetType(ResolvableType.forClassWithGenerics(ClientFactoryBean.class, MyClient.class));
// ...
registry.registerBeanDefinition("myClient", beanDefinition);
RootBeanDefinition beanDefinition = new RootBeanDefinition(ClientFactoryBean.class);
beanDefinition.setTargetType(ResolvableType.forClassWithGenerics(ClientFactoryBean.class, MyClient.class));
// ...
registry.registerBeanDefinition("myClient", beanDefinition);
----
Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
----
val beanDefinition = RootBeanDefinition(ClientFactoryBean::class.java)
beanDefinition.setTargetType(ResolvableType.forClassWithGenerics(ClientFactoryBean::class.java, MyClient::class.java));
// ...
registry.registerBeanDefinition("myClient", beanDefinition)
val beanDefinition = RootBeanDefinition(ClientFactoryBean::class.java)
beanDefinition.setTargetType(ResolvableType.forClassWithGenerics(ClientFactoryBean::class.java, MyClient::class.java));
// ...
registry.registerBeanDefinition("myClient", beanDefinition)
----
======
@@ -520,7 +525,7 @@ Kotlin::
----
======
To make sure the scanning occurs ahead of time, a `PersistenceManagedTypes` bean must be declared and used by the
To ensure that entity scanning occurs ahead of time, a `PersistenceManagedTypes` bean must be declared and used by the
factory bean definition, as shown by the following example:
[tabs]
@@ -564,6 +569,7 @@ Kotlin::
----
======
[[aot.hints]]
== Runtime Hints
@@ -598,35 +604,38 @@ For instance, the return type of a `@Controller` method is inspected, and releva
For cases that the core container cannot infer, you can register such hints programmatically.
A number of convenient annotations are also provided for common use cases.
[[aot.hints.import-runtime-hints]]
=== `@ImportRuntimeHints`
`RuntimeHintsRegistrar` implementations allow you to get a callback to the `RuntimeHints` instance managed by the AOT engine.
Implementations of this interface can be registered using `@ImportRuntimeHints` on any Spring bean or `@Bean` factory method.
`RuntimeHintsRegistrar` implementations are detected and invoked at build time.
{spring-framework-api}/aot/hint/RuntimeHintsRegistrar.html[`RuntimeHintsRegistrar`]
implementations allow you to get a callback to the `RuntimeHints` instance managed by the
AOT engine. Implementations of this interface can be registered using
{spring-framework-api}/context/annotation/ImportRuntimeHints.html[`@ImportRuntimeHints`]
on any Spring bean or `@Bean` factory method. `RuntimeHintsRegistrar` implementations are
detected and invoked at build time.
include-code::./SpellCheckService[]
If at all possible, `@ImportRuntimeHints` should be used as close as possible to the component that requires the hints.
This way, if the component is not contributed to the `BeanFactory`, the hints won't be contributed either.
This way, if the component is not contributed to the `BeanFactory`, the hints will not be contributed either.
It is also possible to register an implementation statically by adding an entry in `META-INF/spring/aot.factories` with a key equal to the fully-qualified name of the `RuntimeHintsRegistrar` interface.
[[aot.hints.reflective]]
=== `@Reflective`
{spring-framework-api}/aot/hint/annotation/Reflective.html[`@Reflective`] provides an idiomatic way to flag the need for reflection on an annotated element.
For instance, `@EventListener` is meta-annotated with `@Reflective` since the underlying implementation invokes the annotated method using reflection.
Out-of-the-box, only Spring beans are considered but you can opt-in for scanning using `@ReflectiveScan`.
In the example below, all types of the package `com.example.app` and their subpackages are considered:
Out-of-the-box, only Spring beans are considered, but you can opt-in for scanning using
{spring-framework-api}/context/annotation/ReflectiveScan.html[`@ReflectiveScan`]. In the
example below, all types in the `com.example.app` package and its subpackages are
considered:
include-code::./MyConfiguration[]
Scanning happens during AOT processing and the types in the target packages do not need to have a class-level annotation to be considered.
This performs a "deep scan" and the presence of `@Reflective`, either directly or as a meta-annotation, is checked on types, fields, constructors, methods, and enclosed elements.
Scanning happens during AOT processing, and the types in the target packages do not need to have a class-level annotation to be considered.
This performs a _deep scan_, and the presence of `@Reflective`, either directly or as a meta-annotation, is checked on types, fields, constructors, methods, and enclosed elements.
By default, `@Reflective` registers an invocation hint for the annotated element.
This can be tuned by specifying a custom `ReflectiveProcessor` implementation via the `@Reflective` annotation.
@@ -634,13 +643,12 @@ This can be tuned by specifying a custom `ReflectiveProcessor` implementation vi
Library authors can reuse this annotation for their own purposes.
An example of such customization is covered in the next section.
[[aot.hints.register-reflection]]
=== `@RegisterReflection`
{spring-framework-api}/aot/hint/annotation/RegisterReflection.html[`@RegisterReflection`] is a specialization of `@Reflective` that provides a declarative way of registering reflection for arbitrary types.
{spring-framework-api}/aot/hint/annotation/RegisterReflection.html[`@RegisterReflection`] is a specialization of `@Reflective` that provides a declarative way to register reflection for arbitrary types.
NOTE: As a specialization of `@Reflective`, this is also detected if you're using `@ReflectiveScan`.
NOTE: As a specialization of `@Reflective`, `@RegisterReflection` is also detected if you are using `@ReflectiveScan`.
In the following example, public constructors and public methods can be invoked via reflection on `AccountService`:
@@ -648,8 +656,8 @@ include-code::./MyConfiguration[tag=snippet,indent=0]
`@RegisterReflection` can be applied to any target type at the class level, but it can also be applied directly to a method to better indicate where the hints are actually required.
`@RegisterReflection` can be used as a meta-annotation to provide more specific needs.
{spring-framework-api}/aot/hint/annotation/RegisterReflectionForBinding.html[`@RegisterReflectionForBinding`] is such composed annotation and registers the need for serializing arbitrary types.
`@RegisterReflection` can be used as a meta-annotation to support more specific needs.
{spring-framework-api}/aot/hint/annotation/RegisterReflectionForBinding.html[`@RegisterReflectionForBinding`] is a composed annotation that is meta-annotated with `@RegisterReflection` and registers the need for serializing arbitrary types.
A typical use case is the use of DTOs that the container cannot infer, such as using a web client within a method body.
The following example registers `Order` for serialization.
@@ -660,11 +668,66 @@ This registers hints for constructors, fields, properties, and record components
Hints are also registered for types transitively used on properties and record components.
In other words, if `Order` exposes others types, hints are registered for those as well.
[[aot.hints.convention-based-conversion]]
=== Runtime Hints for Convention-based Conversion
Although the core container provides built-in support for automatic conversion of many
common types (see xref:core/validation/convert.adoc[Spring Type Conversion]), some
conversions are supported via a convention-based algorithm that relies on reflection.
Specifically, if there is no explicit `Converter` registered with the `ConversionService`
for a particular source &#8594; target type pair, the internal `ObjectToObjectConverter`
will attempt to use conventions to convert a source object to a target type by delegating
to a method on the source object or to a static factory method or constructor on the
target type. Since this convention-based algorithm can be applied to arbitrary types at
runtime, the core container is not able to infer the runtime hints necessary to support
such reflection.
If you encounter convention-based conversion issues within a native image resulting from
lacking runtime hints, you can register the necessary hints programmatically. For
example, if your application requires a conversion from `java.time.Instant` to
`java.sql.Timestamp` and relies on `ObjectToObjectConverter` to invoke
`java.sql.Timestamp.from(Instant)` using reflection, you could implement a custom
`RuntimeHintsRegitrar` to support this use case within a native image, as demonstrated in
the following example.
[tabs]
======
Java::
+
[source,java,indent=0,subs="verbatim,quotes"]
----
public class TimestampConversionRuntimeHints implements RuntimeHintsRegistrar {
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
ReflectionHints reflectionHints = hints.reflection();
reflectionHints.registerTypeIfPresent(classLoader, "java.sql.Timestamp", hint -> hint
.withMethod("from", List.of(TypeReference.of(Instant.class)), ExecutableMode.INVOKE)
.onReachableType(TypeReference.of("java.sql.Timestamp")));
}
}
----
======
`TimestampConversionRuntimeHints` can then be registered declaratively via
<<aot.hints.import-runtime-hints>> or statically via a `META-INF/spring/aot.factories`
configuration file.
[NOTE]
====
The above `TimestampConversionRuntimeHints` class is a simplified version of the
`ObjectToObjectConverterRuntimeHints` class that is included in the framework and
registered by default.
Thus, this specific `Instant`-to-`Timestamp` use case is already handled by the framework.
====
[[aot.hints.testing]]
=== Testing Runtime Hints
Spring Core also ships `RuntimeHintsPredicates`, a utility for checking that existing hints match a particular use case.
This can be used in your own tests to validate that a `RuntimeHintsRegistrar` contains the expected results.
This can be used in your own tests to validate that a `RuntimeHintsRegistrar` produces the expected results.
We can write a test for our `SpellCheckService` and ensure that we will be able to load a dictionary at runtime:
include-code::./SpellCheckServiceTests[tag=hintspredicates]
@@ -1,7 +1,3 @@
[[appendix]]
= Appendix
:page-section-summary-toc: 1
@@ -12,7 +12,6 @@ Spring's extensible XML configuration mechanism is based on XML Schema. If you a
familiar with Spring's current XML configuration extensions that come with the standard
Spring distribution, you should first read the previous section on xref:core/appendix/xsd-schemas.adoc[XML Schemas].
To create new XML configuration extensions:
. xref:core/appendix/xml-custom.adoc#core.appendix.xsd-custom-schema[Author] an XML schema to describe your custom element(s).
@@ -38,7 +37,6 @@ examples follow later in this appendix. The intent of this first simple example
through the basic steps of making a custom extension.)
[[xsd-custom-schema]]
== Authoring the Schema
@@ -110,7 +108,6 @@ can use autocompletion to let a user choose between several configuration option
defined in the enumeration.
[[xsd-custom-namespacehandler]]
== Coding a `NamespaceHandler`
@@ -187,7 +184,6 @@ means that each `BeanDefinitionParser` contains only the logic for parsing a sin
custom element, as we can see in the next step.
[[xsd-custom-parser]]
== Using `BeanDefinitionParser`
@@ -276,13 +272,11 @@ the basic grunt work of creating a single `BeanDefinition`.
single `BeanDefinition` represents.
======
In this simple case, this is all that we need to do. The creation of our single
`BeanDefinition` is handled by the `AbstractSingleBeanDefinitionParser` superclass, as
is the extraction and setting of the bean definition's unique identifier.
[[xsd-custom-registration]]
== Registering the Handler and the Schema
@@ -294,7 +288,6 @@ can, for example, be distributed alongside your binary classes in a JAR file. Th
XML parsing infrastructure automatically picks up your new extension by consuming
these special properties files, the formats of which are detailed in the next two sections.
[[xsd-custom-registration-spring-handlers]]
=== Writing `META-INF/spring.handlers`
@@ -313,7 +306,6 @@ The first part (the key) of the key-value pair is the URI associated with your c
namespace extension and needs to exactly match exactly the value of the `targetNamespace`
attribute, as specified in your custom XSD schema.
[[xsd-custom-registration-spring-schemas]]
=== Writing 'META-INF/spring.schemas'
@@ -337,7 +329,6 @@ You are encouraged to deploy your XSD file (or files) right alongside
the `NamespaceHandler` and `BeanDefinitionParser` classes on the classpath.
[[xsd-custom-using]]
== Using a Custom Extension in Your Spring XML Configuration
@@ -371,13 +362,11 @@ in a Spring XML configuration file:
<1> Our custom bean.
[[xsd-custom-meat]]
== More Detailed Examples
This section presents some more detailed examples of custom XML extensions.
[[xsd-custom-custom-nested]]
=== Nesting Custom Elements within Custom Elements
@@ -753,7 +742,6 @@ http\://www.foo.example/schema/component=com.foo.ComponentNamespaceHandler
http\://www.foo.example/schema/component/component.xsd=com/foo/component.xsd
----
[[xsd-custom-custom-just-attributes]]
=== Custom Attributes on "`Normal`" Elements
@@ -1007,5 +995,3 @@ http\://www.foo.example/schema/jcache=com.foo.JCacheNamespaceHandler
# in 'META-INF/spring.schemas'
http\://www.foo.example/schema/jcache/jcache.xsd=com/foo/jcache.xsd
----
@@ -4,7 +4,6 @@
This part of the appendix lists XML schemas related to the core container.
[[xsd-schemas-util]]
== The `util` Schema
@@ -29,7 +28,6 @@ correct schema so that the tags in the `util` namespace are available to you):
</beans>
----
[[xsd-schemas-util-constant]]
=== Using `<util:constant/>`
@@ -186,7 +184,6 @@ Kotlin::
</bean>
----
[[xsd-schemas-util-property-path]]
=== Using `<util:property-path/>`
@@ -308,7 +305,6 @@ You can specifically set the result type in the actual definition. This is not n
for most use cases, but it can sometimes be useful. See the javadoc for more info on
this feature.
[[xsd-schemas-util-properties]]
=== Using `<util:properties/>`
@@ -334,7 +330,6 @@ The following example uses a `util:properties` element to make a more concise re
<util:properties id="jdbcConfiguration" location="classpath:com/foo/jdbc-production.properties"/>
----
[[xsd-schemas-util-list]]
=== Using `<util:list/>`
@@ -389,7 +384,6 @@ following configuration:
If no `list-class` attribute is supplied, the container chooses a `List` implementation.
[[xsd-schemas-util-map]]
=== Using `<util:map/>`
@@ -444,7 +438,6 @@ following configuration:
If no `'map-class'` attribute is supplied, the container chooses a `Map` implementation.
[[xsd-schemas-util-set]]
=== Using `<util:set/>`
@@ -500,7 +493,6 @@ following configuration:
If no `set-class` attribute is supplied, the container chooses a `Set` implementation.
[[xsd-schemas-aop]]
== The `aop` Schema
@@ -530,7 +522,6 @@ are available to you):
----
[[xsd-schemas-context]]
== The `context` Schema
@@ -555,7 +546,6 @@ available to you:
</beans>
----
[[xsd-schemas-context-pphc]]
=== Using `<property-placeholder/>`
@@ -599,34 +589,25 @@ element for that purpose. Similarly, Spring's
xref:integration/cache/annotations.adoc[caching annotations] need to be explicitly
xref:integration/cache/annotations.adoc#cache-annotation-enable[enabled] as well.
[[xsd-schemas-context-component-scan]]
=== Using `<component-scan/>`
This element is detailed in the section on xref:core/beans/annotation-config.adoc[annotation-based container configuration]
.
This element is detailed in the section on xref:core/beans/annotation-config.adoc[annotation-based container configuration].
[[xsd-schemas-context-ltw]]
=== Using `<load-time-weaver/>`
This element is detailed in the section on xref:core/aop/using-aspectj.adoc#aop-aj-ltw[load-time weaving with AspectJ in the Spring Framework]
.
This element is detailed in the section on xref:core/aop/using-aspectj.adoc#aop-aj-ltw[load-time weaving with AspectJ in the Spring Framework].
[[xsd-schemas-context-sc]]
=== Using `<spring-configured/>`
This element is detailed in the section on xref:core/aop/using-aspectj.adoc#aop-atconfigurable[using AspectJ to dependency inject domain objects with Spring]
.
This element is detailed in the section on xref:core/aop/using-aspectj.adoc#aop-atconfigurable[using AspectJ to dependency inject domain objects with Spring].
[[xsd-schemas-context-mbe]]
=== Using `<mbean-export/>`
This element is detailed in the section on xref:integration/jmx/naming.adoc#jmx-context-mbeanexport[configuring annotation-based MBean export]
.
This element is detailed in the section on xref:integration/jmx/naming.adoc#jmx-context-mbeanexport[configuring annotation-based MBean export].
[[xsd-schemas-beans]]
@@ -666,7 +647,3 @@ as it stands).
In the case of the preceding example, you could assume that there is some logic that consumes
the bean definition and sets up some caching infrastructure that uses the supplied metadata.
@@ -3,7 +3,3 @@
:page-section-summary-toc: 1
This chapter covers Spring's Inversion of Control (IoC) container.
@@ -62,6 +62,3 @@ application context in which it is defined. This means that, if you put
it only checks for `@Autowired` beans in your controllers, and not your services. See
xref:web/webmvc/mvc-servlet.adoc[The DispatcherServlet] for more information.
====
@@ -152,6 +152,3 @@ The corresponding bean definitions follow:
</beans>
----
@@ -151,17 +151,17 @@ injected into a `Set<MovieCatalog>` annotated with `@Qualifier("action")`.
[TIP]
====
Letting qualifier values select against target bean names, within the type-matching
candidates, does not require a `@Qualifier` annotation at the injection point.
If there is no other resolution indicator (such as a qualifier or a primary marker),
for a non-unique dependency situation, Spring matches the injection point name
(that is, the field name or parameter name) against the target bean names and chooses
the same-named candidate, if any (either by bean name or by associated alias).
candidates, does not require a `@Qualifier` annotation at the injection point. If there
is no other resolution indicator (such as a qualifier, a primary marker, or a fallback
marker), for a non-unique dependency situation, Spring matches the injection point name
(that is, the field name or parameter name) against the target bean names and chooses the
same-named candidate, if any (either by bean name or by associated alias).
Since version 6.1, this requires the `-parameters` Java compiler flag to be present.
As of 6.2, the container applies fast shortcut resolution for bean name matches,
bypassing the full type matching algorithm when the parameter name matches the
bean name and no type, qualifier or primary conditions override the match. It is
therefore recommendable for your parameter names to match the target bean names.
Since version 6.1, this requires the `-parameters` Java compiler flag to be present. As
of 6.2, the container applies fast shortcut resolution for bean name matches, bypassing
the full type matching algorithm when the parameter name matches the bean name and no
type, qualifier, primary, or fallback conditions override the match. It is therefore
recommendable for your parameter names to match the target bean names.
====
As an alternative for injection by name, consider the JSR-250 `@Resource` annotation
@@ -274,7 +274,7 @@ Kotlin::
Next, you can provide the information for the candidate bean definitions. You can add
`<qualifier/>` tags as sub-elements of the `<bean/>` tag and then specify the `type` and
`value` to match your custom qualifier annotations. The type is matched against the
fully-qualified class name of the annotation. Alternately, as a convenience if no risk of
fully-qualified class name of the annotation. Alternatively, as a convenience if no risk of
conflicting names exists, you can use the short class name. The following example
demonstrates both approaches:
@@ -568,6 +568,3 @@ the following example:
</beans>
----
--
@@ -308,7 +308,8 @@ set of multiple matches for the specific bean type (as returned by the factory m
Note that the standard `jakarta.annotation.Priority` annotation is not available at the
`@Bean` level, since it cannot be declared on methods. Its semantics can be modeled
through `@Order` values in combination with `@Primary` on a single bean for each type.
through `@Order` values in combination with `@Primary` or `@Fallback` on a single bean
for each type.
====
Even typed `Map` instances can be autowired as long as the expected key type is `String`.
@@ -444,9 +445,9 @@ through Java 8's `java.util.Optional`, as the following example shows:
}
----
You can also use a `@Nullable` annotation (of any kind in any package -- for example,
`javax.annotation.Nullable` from JSR-305) or just leverage Kotlin built-in null-safety
support:
You can also use a parameter-level `@Nullable` annotation (of any kind in any package --
for example, `javax.annotation.Nullable` from JSR-305) or just leverage Kotlin built-in
null-safety support:
[tabs]
======
@@ -477,6 +478,13 @@ Kotlin::
----
======
[NOTE]
====
A type-level `@Nullable` annotation such as from JSpecify is not supported in Spring
Framework 6.2 yet. You need to upgrade to Spring Framework 7.0 where the framework
detects type-level annotations and consistently declares JSpecify in its own codebase.
====
You can also use `@Autowired` for interfaces that are well-known resolvable
dependencies: `BeanFactory`, `ApplicationContext`, `Environment`, `ResourceLoader`,
`ApplicationEventPublisher`, and `MessageSource`. These interfaces and their extended
@@ -523,6 +531,3 @@ The `@Autowired`, `@Inject`, `@Value`, and `@Resource` annotations are handled b
within your own `BeanPostProcessor` or `BeanFactoryPostProcessor` types (if any).
These types must be 'wired up' explicitly by using XML or a Spring `@Bean` method.
====
@@ -27,7 +27,5 @@ with the `CustomAutowireConfigurer`
When multiple beans qualify as autowire candidates, the determination of a "`primary`" is
as follows: If exactly one bean definition among the candidates has a `primary`
attribute set to `true`, it is selected.
attribute set to `true`, it is selected. For annotation-based configuration, see
xref:core/beans/annotation-config/autowired-primary.adoc[Fine-tuning with `@Primary` or `@Fallback`].
@@ -96,6 +96,3 @@ Kotlin::
private lateinit var s: List<Store<Integer>>
----
======
@@ -64,7 +64,3 @@ JDK 11. As of Jakarta EE 9, the package lives in `jakarta.annotation` now. If ne
the `jakarta.annotation-api` artifact needs to be obtained via Maven Central now,
simply to be added to the application's classpath like any other library.
====
@@ -142,4 +142,3 @@ Kotlin::
`ApplicationContext`.
======
--
@@ -9,15 +9,15 @@ Java::
+
[source,java,indent=0,subs="verbatim,quotes"]
----
@Component
public class MovieRecommender {
@Component
public class MovieRecommender {
private final String catalog;
private final String catalog;
public MovieRecommender(@Value("${catalog.name}") String catalog) {
this.catalog = catalog;
}
}
public MovieRecommender(@Value("${catalog.name}") String catalog) {
this.catalog = catalog;
}
}
----
Kotlin::
@@ -37,9 +37,9 @@ Java::
+
[source,java,indent=0,subs="verbatim,quotes"]
----
@Configuration
@PropertySource("classpath:application.properties")
public class AppConfig { }
@Configuration
@PropertySource("classpath:application.properties")
public class AppConfig { }
----
Kotlin::
@@ -56,7 +56,7 @@ And the following `application.properties` file:
[source,java,indent=0,subs="verbatim,quotes"]
----
catalog.name=MovieCatalog
catalog.name=MovieCatalog
----
In that case, the `catalog` parameter and field will be equal to the `MovieCatalog` value.
@@ -101,8 +101,11 @@ NOTE: When configuring a `PropertySourcesPlaceholderConfigurer` using JavaConfig
Using the above configuration ensures Spring initialization failure if any `${}`
placeholder could not be resolved. It is also possible to use methods like
`setPlaceholderPrefix`, `setPlaceholderSuffix`, `setValueSeparator`, or
`setEscapeCharacter` to customize placeholders.
`setPlaceholderPrefix()`, `setPlaceholderSuffix()`, `setValueSeparator()`, or
`setEscapeCharacter()` to customize the placeholder syntax. In addition, the default
escape character can be changed or disabled globally by setting the
`spring.placeholder.escapeCharacter.default` property via a JVM system property (or via
the xref:appendix.adoc#appendix-spring-properties[`SpringProperties`] mechanism).
NOTE: Spring Boot configures by default a `PropertySourcesPlaceholderConfigurer` bean that
will get properties from `application.properties` and `application.yml` files.
@@ -119,15 +122,15 @@ Java::
+
[source,java,indent=0,subs="verbatim,quotes"]
----
@Component
public class MovieRecommender {
@Component
public class MovieRecommender {
private final String catalog;
private final String catalog;
public MovieRecommender(@Value("${catalog.name:defaultCatalog}") String catalog) {
this.catalog = catalog;
}
}
public MovieRecommender(@Value("${catalog.name:defaultCatalog}") String catalog) {
this.catalog = catalog;
}
}
----
Kotlin::
@@ -150,16 +153,16 @@ Java::
+
[source,java,indent=0,subs="verbatim,quotes"]
----
@Configuration
public class AppConfig {
@Configuration
public class AppConfig {
@Bean
public ConversionService conversionService() {
DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService();
conversionService.addConverter(new MyCustomConverter());
return conversionService;
}
}
@Bean
public ConversionService conversionService() {
DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService();
conversionService.addConverter(new MyCustomConverter());
return conversionService;
}
}
----
Kotlin::
@@ -188,15 +191,15 @@ Java::
+
[source,java,indent=0,subs="verbatim,quotes"]
----
@Component
public class MovieRecommender {
@Component
public class MovieRecommender {
private final String catalog;
private final String catalog;
public MovieRecommender(@Value("#{systemProperties['user.catalog'] + 'Catalog' }") String catalog) {
this.catalog = catalog;
}
}
public MovieRecommender(@Value("#{systemProperties['user.catalog'] + 'Catalog' }") String catalog) {
this.catalog = catalog;
}
}
----
Kotlin::
@@ -217,16 +220,16 @@ Java::
+
[source,java,indent=0,subs="verbatim,quotes"]
----
@Component
public class MovieRecommender {
@Component
public class MovieRecommender {
private final Map<String, Integer> countOfMoviesPerCatalog;
private final Map<String, Integer> countOfMoviesPerCatalog;
public MovieRecommender(
@Value("#{{'Thriller': 100, 'Comedy': 300}}") Map<String, Integer> countOfMoviesPerCatalog) {
this.countOfMoviesPerCatalog = countOfMoviesPerCatalog;
}
}
public MovieRecommender(
@Value("#{{'Thriller': 100, 'Comedy': 300}}") Map<String, Integer> countOfMoviesPerCatalog) {
this.countOfMoviesPerCatalog = countOfMoviesPerCatalog;
}
}
----
Kotlin::
@@ -238,5 +241,3 @@ Kotlin::
@Value("#{{'Thriller': 100, 'Comedy': 300}}") private val countOfMoviesPerCatalog: Map<String, Int>)
----
======
@@ -29,7 +29,6 @@ created and initialized, you have a fully configured and executable system or ap
image::container-magic.png[]
[[beans-factory-metadata]]
== Configuration Metadata
@@ -63,8 +62,6 @@ Typically, one does not configure fine-grained domain objects in the container,
it is usually the responsibility of repositories and business logic to create and load
domain objects.
[[beans-factory-xml]]
=== XML as an External Configuration DSL
@@ -119,7 +116,7 @@ Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
----
val context = ClassPathXmlApplicationContext("services.xml", "daos.xml")
val context = ClassPathXmlApplicationContext("services.xml", "daos.xml")
----
======
@@ -188,7 +185,6 @@ definition. This linkage between `id` and `ref` elements expresses the dependenc
collaborating objects. For details of configuring an object's dependencies, see
xref:core/beans/dependencies.adoc[Dependencies].
[[beans-factory-xml-import]]
=== Composing XML-based Configuration Metadata
@@ -244,7 +240,6 @@ The namespace itself provides the import directive feature. Further
configuration features beyond plain bean definitions are available in a selection
of XML namespaces provided by Spring -- for example, the `context` and `util` namespaces.
[[beans-factory-groovy]]
=== The Groovy Bean Definition DSL
@@ -279,7 +274,6 @@ supports Spring's XML configuration namespaces. It also allows for importing XML
bean definition files through an `importBeans` directive.
[[beans-factory-client]]
== Using the Container
@@ -310,16 +304,16 @@ Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
----
import org.springframework.beans.factory.getBean
import org.springframework.beans.factory.getBean
// create and configure beans
val context = ClassPathXmlApplicationContext("services.xml", "daos.xml")
val context = ClassPathXmlApplicationContext("services.xml", "daos.xml")
// retrieve configured instance
val service = context.getBean<PetStoreService>("petStore")
// retrieve configured instance
val service = context.getBean<PetStoreService>("petStore")
// use configured instance
var userList = service.getUsernameList()
// use configured instance
var userList = service.getUsernameList()
----
======
@@ -403,6 +397,3 @@ code should never use them. Indeed, your application code should have no calls t
Spring's integration with web frameworks provides dependency injection for various web
framework components such as controllers and JSF-managed beans, letting you declare
a dependency on a specific bean through metadata (such as an autowiring annotation).
@@ -21,7 +21,6 @@ operate on shared `BeanDefinition` objects as a core metadata representation.
This is the essence of what makes Spring's container so flexible and extensible.
[[context-introduction-ctx-vs-beanfactory]]
== `BeanFactory` or `ApplicationContext`?
@@ -78,7 +78,3 @@ important (at least for singleton beans) that if you have a (parent) bean defini
which you intend to use only as a template, and this definition specifies a class, you
must make sure to set the __abstract__ attribute to __true__, otherwise the application
context will actually (attempt to) pre-instantiate the `abstract` bean.
@@ -1,28 +1,29 @@
[[beans-classpath-scanning]]
= Classpath Scanning and Managed Components
Most examples in this chapter use XML to specify the configuration metadata that produces
each `BeanDefinition` within the Spring container. The previous section
(xref:core/beans/annotation-config.adoc[Annotation-based Container Configuration]) demonstrates how to provide a lot of the configuration
metadata through source-level annotations. Even in those examples, however, the "base"
bean definitions are explicitly defined in the XML file, while the annotations drive only
the dependency injection. This section describes an option for implicitly detecting the
candidate components by scanning the classpath. Candidate components are classes that
match against a filter criteria and have a corresponding bean definition registered with
the container. This removes the need to use XML to perform bean registration. Instead, you
can use annotations (for example, `@Component`), AspectJ type expressions, or your own
Most examples in this chapter use XML to specify the configuration metadata that
produces each `BeanDefinition` within the Spring container. The previous section
(xref:core/beans/annotation-config.adoc[Annotation-based Container Configuration])
demonstrates how to provide a lot of the configuration metadata through source-level
annotations. Even in those examples, however, the "base" bean definitions are explicitly
defined in the XML file, while the annotations drive only the dependency injection.
This section describes an option for implicitly detecting the candidate components by
scanning the classpath. Candidate components are classes that match against a filter
criteria and have a corresponding bean definition registered with the container.
This removes the need to use XML to perform bean registration. Instead, you can use
annotations (for example, `@Component`), AspectJ type expressions, or your own
custom filter criteria to select which classes have bean definitions registered with
the container.
[NOTE]
====
You can define beans using Java rather than using XML files. Take a look at the
`@Configuration`, `@Bean`, `@Import`, and `@DependsOn` annotations for examples of how to
use these features.
`@Configuration`, `@Bean`, `@Import`, and `@DependsOn` annotations for examples
of how to use these features.
====
[[beans-stereotype-annotations]]
== `@Component` and Further Stereotype Annotations
@@ -46,7 +47,6 @@ clearly the better choice. Similarly, as stated earlier, `@Repository` is alread
supported as a marker for automatic exception translation in your persistence layer.
[[beans-meta-annotations]]
== Using Meta-annotations and Composed Annotations
@@ -195,7 +195,6 @@ For further details, see the
wiki page.
[[beans-scanning-autodetection]]
== Automatically Detecting Classes and Registering Bean Definitions
@@ -334,7 +333,6 @@ NOTE: You can disable the registration of `AutowiredAnnotationBeanPostProcessor`
with a value of `false`.
[[beans-scanning-filters]]
== Using Filters to Customize Scanning
@@ -426,7 +424,6 @@ annotated or meta-annotated with `@Component`, `@Repository`, `@Service`, `@Cont
`@RestController`, or `@Configuration`.
[[beans-factorybeans-annotations]]
== Defining Bean Metadata within Components
@@ -663,7 +660,6 @@ analogous to how the container selects between multiple `@Autowired` constructor
====
[[beans-scanning-name-generator]]
== Naming Autodetected Components
@@ -797,7 +793,6 @@ components may be making explicit references to it. On the other hand, the
auto-generated names are adequate whenever the container is responsible for wiring.
[[beans-scanning-scope-resolver]]
== Providing a Scope for Autodetected Components
@@ -837,10 +832,10 @@ definitions, there is no notion of bean definition inheritance, and inheritance
hierarchies at the class level are irrelevant for metadata purposes.
For details on web-specific scopes such as "`request`" or "`session`" in a Spring context,
see xref:core/beans/factory-scopes.adoc#beans-factory-scopes-other[Request, Session, Application, and WebSocket Scopes]. As with the pre-built annotations for those scopes,
you may also compose your own scoping annotations by using Spring's meta-annotation
approach: for example, a custom annotation meta-annotated with `@Scope("prototype")`,
possibly also declaring a custom scoped-proxy mode.
see xref:core/beans/factory-scopes.adoc#beans-factory-scopes-other[Request, Session, Application, and WebSocket Scopes].
As with the pre-built annotations for those scopes, you may also compose your own scoping
annotations by using Spring's meta-annotation approach: for example, a custom annotation
meta-annotated with `@Scope("prototype")`, possibly also declaring a custom scoped-proxy mode.
NOTE: To provide a custom strategy for scope resolution rather than relying on the
annotation-based approach, you can implement the
@@ -882,7 +877,8 @@ Kotlin::
----
When using certain non-singleton scopes, it may be necessary to generate proxies for the
scoped objects. The reasoning is described in xref:core/beans/factory-scopes.adoc#beans-factory-scopes-other-injection[Scoped Beans as Dependencies].
scoped objects. The reasoning is described in
xref:core/beans/factory-scopes.adoc#beans-factory-scopes-other-injection[Scoped Beans as Dependencies].
For this purpose, a scoped-proxy attribute is available on the component-scan
element. The three possible values are: `no`, `interfaces`, and `targetClass`. For example,
the following configuration results in standard JDK dynamic proxies:
@@ -920,7 +916,6 @@ Kotlin::
----
[[beans-scanning-qualifiers]]
== Providing Qualifier Metadata with Annotations
@@ -1012,7 +1007,3 @@ NOTE: As with most annotation-based alternatives, keep in mind that the annotati
bound to the class definition itself, while the use of XML allows for multiple beans
of the same type to provide variations in their qualifier metadata, because that
metadata is provided per-instance rather than per-class.
@@ -24,7 +24,6 @@ package also provides the following functionality:
`HierarchicalBeanFactory` interface.
[[context-functionality-messagesource]]
== Internationalization using `MessageSource`
@@ -273,7 +272,6 @@ See the {spring-framework-api}/context/support/ReloadableResourceBundleMessageSo
javadoc for details.
[[context-functionality-events]]
== Standard and Custom Events
@@ -513,7 +511,7 @@ the classes above:
<property name="notificationAddress" value="blockedlist@example.org"/>
</bean>
<!-- optional: a custom ApplicationEventMulticaster definition -->
<!-- optional: a custom ApplicationEventMulticaster definition -->
<bean id="applicationEventMulticaster" class="org.springframework.context.event.SimpleApplicationEventMulticaster">
<property name="taskExecutor" ref="..."/>
<property name="errorHandler" ref="..."/>
@@ -534,7 +532,6 @@ complete support for building lightweight,
https://www.enterpriseintegrationpatterns.com[pattern-oriented], event-driven
architectures that build upon the well-known Spring programming model.
[[context-functionality-events-annotation]]
=== Annotation-based Event Listeners
@@ -578,7 +575,7 @@ Kotlin::
----
======
NOTE: Do not define such beans to be lazy as the `ApplicationContext` will honour that and will not register the method to listen to events.
NOTE: Do not define such beans to be lazy as the `ApplicationContext` will honor that and will not register the method to listen to events.
The method signature once again declares the event type to which it listens,
but, this time, with a flexible name and without implementing a specific listener interface.
@@ -707,7 +704,6 @@ The `handleBlockedListEvent()` method publishes a new `ListUpdateEvent` for ever
`BlockedListEvent` that it handles. If you need to publish several events, you can return
a `Collection` or an array of events instead.
[[context-functionality-events-async]]
=== Asynchronous Listeners
@@ -754,7 +750,6 @@ Be aware of the following limitations when using asynchronous events:
See xref:integration/observability.adoc#observability.application-events[the `@EventListener` Observability section]
for more information on Observability concerns.
[[context-functionality-events-order]]
=== Ordering Listeners
@@ -786,7 +781,6 @@ Kotlin::
----
======
[[context-functionality-events-generics]]
=== Generic Events
@@ -880,7 +874,6 @@ for example, for processing all events asynchronously and/or for handling listen
----
[[context-functionality-resources]]
== Convenient Access to Low-level Resources
@@ -913,7 +906,6 @@ with special prefixes to force loading of definitions from the classpath or a UR
regardless of the actual context type.
[[context-functionality-startup]]
== Application Startup Tracking
@@ -990,6 +982,7 @@ or ask for the `ApplicationStartup` type on any injection point.
NOTE: Developers should not use the `"spring.*"` namespace when creating custom startup steps.
This namespace is reserved for internal Spring usage and is subject to change.
[[context-create]]
== Convenient ApplicationContext Instantiation for Web Applications
@@ -1022,7 +1015,6 @@ Examples are `/WEB-INF/{asterisk}Context.xml` (for all files with names that end
(for all such files in any subdirectory of `WEB-INF`).
[[context-deploy-rar]]
== Deploying a Spring `ApplicationContext` as a Jakarta EE RAR File
@@ -1053,7 +1045,8 @@ all application classes into a RAR file (which is a standard JAR file with a dif
file extension).
. Add all required library JARs into the root of the RAR archive.
. Add a
`META-INF/ra.xml` deployment descriptor (as shown in the {spring-framework-api}/jca/context/SpringContextResourceAdapter.html[javadoc for `SpringContextResourceAdapter`])
`META-INF/ra.xml` deployment descriptor (as shown in the
{spring-framework-api}/jca/context/SpringContextResourceAdapter.html[javadoc for `SpringContextResourceAdapter`])
and the corresponding Spring XML bean definition file(s) (typically
`META-INF/applicationContext.xml`).
. Drop the resulting RAR file into your
@@ -1066,7 +1059,3 @@ other modules. A RAR-based `ApplicationContext` may also, for example, schedule
or react to new files in the file system (or the like). If it needs to allow synchronous
access from the outside, it could (for example) export RMI endpoints, which may be used
by other application modules on the same machine.
@@ -45,8 +45,5 @@ xref:data-access/orm/jpa.adoc[Spring's JPA support] where load-time weaving may
necessary for JPA class transformation.
Consult the
{spring-framework-api}/orm/jpa/LocalContainerEntityManagerFactoryBean.html[`LocalContainerEntityManagerFactoryBean`]
javadoc for more detail. For more on AspectJ load-time weaving, see xref:core/aop/using-aspectj.adoc#aop-aj-ltw[Load-time Weaving with AspectJ in the Spring Framework].
javadoc for more detail. For more on AspectJ load-time weaving, see
xref:core/aop/using-aspectj.adoc#aop-aj-ltw[Load-time Weaving with AspectJ in the Spring Framework].
@@ -74,7 +74,6 @@ lead to concurrent access exceptions, inconsistent state in the bean container,
====
[[beans-definition-overriding]]
== Overriding Beans
@@ -104,7 +103,6 @@ explicit support for this as of Spring Framework 6.2. Please refer to
xref:testing/testcontext-framework/bean-overriding.adoc[this section] for more details.
[[beans-beanname]]
== Naming Beans
@@ -147,7 +145,6 @@ case when there is more than one character and both the first and second charact
are upper case, the original casing gets preserved. These are the same rules as
defined by `java.beans.Introspector.decapitalize` (which Spring uses here).
[[beans-beanname-alias]]
=== Aliasing a Bean outside the Bean Definition
@@ -197,7 +194,6 @@ See xref:core/beans/java/bean-annotation.adoc[Using the `@Bean` Annotation] for
****
[[beans-factory-class]]
== Instantiating Beans
@@ -209,7 +205,8 @@ If you use XML-based configuration metadata, you specify the type (or class) of
that is to be instantiated in the `class` attribute of the `<bean/>` element. This
`class` attribute (which, internally, is a `Class` property on a `BeanDefinition`
instance) is usually mandatory. (For exceptions, see
xref:core/beans/definition.adoc#beans-factory-class-instance-factory-method[Instantiation by Using an Instance Factory Method] and xref:core/beans/child-bean-definitions.adoc[Bean Definition Inheritance].)
xref:core/beans/definition.adoc#beans-factory-class-instance-factory-method[Instantiation by Using an Instance Factory Method]
and xref:core/beans/child-bean-definitions.adoc[Bean Definition Inheritance].)
You can use the `Class` property in one of two ways:
* Typically, to specify the bean class to be constructed in the case where the container
@@ -233,7 +230,6 @@ a bean definition would be `com.example.SomeThing$OtherThing` or
`com.example.SomeThing.OtherThing`.
****
[[beans-factory-class-ctor]]
=== Instantiation with a Constructor
@@ -268,7 +264,6 @@ NOTE: In the case of constructor arguments, the container can select a correspon
constructor among several overloaded constructors. That said, to avoid ambiguities,
it is recommended to keep your constructor signatures as straightforward as possible.
[[beans-factory-class-static-factory-method]]
=== Instantiation with a Static Factory Method
@@ -346,7 +341,6 @@ overloads of the `mock` method. Choose the most specific variant of `mock` possi
----
====
[[beans-factory-class-instance-factory-method]]
=== Instantiation by Using an Instance Factory Method
@@ -478,7 +472,6 @@ xref:core/beans/definition.adoc#beans-factory-class-static-factory-method[static
`FactoryBean` (notice the capitalization) refers to a Spring-specific
xref:core/beans/factory-extension.adoc#beans-factory-extension-factorybean[`FactoryBean`] implementation class.
[[beans-factory-type-determination]]
=== Determining a Bean's Runtime Type
@@ -494,5 +487,3 @@ The recommended way to find out about the actual runtime type of a particular be
a `BeanFactory.getType` call for the specified bean name. This takes all of the above
cases into account and returns the type of object that a `BeanFactory.getBean` call is
going to return for the same bean name.
@@ -7,6 +7,3 @@ Spring parlance). Even the simplest application has a few objects that work toge
present what the end-user sees as a coherent application. This next section explains how
you go from defining a number of bean definitions that stand alone to a fully realized
application where objects collaborate to achieve a goal.
@@ -16,7 +16,8 @@ advantages:
during development, without negating the option of switching to explicit wiring when
the code base becomes more stable.
When using XML-based configuration metadata (see xref:core/beans/dependencies/factory-collaborators.adoc[Dependency Injection]), you
When using XML-based configuration metadata (see
xref:core/beans/dependencies/factory-collaborators.adoc[Dependency Injection]), you
can specify the autowire mode for a bean definition with the `autowire` attribute of the
`<bean/>` element. The autowiring functionality has four modes. You specify autowiring
per bean and can thus choose which ones to autowire. The following table describes the
@@ -60,7 +61,6 @@ instance's values consist of all bean instances that match the expected type, an
`Map` instance's keys contain the corresponding bean names.
[[beans-autowired-exceptions]]
== Limitations and Disadvantages of Autowiring
@@ -90,14 +90,14 @@ In the latter scenario, you have several options:
* Abandon autowiring in favor of explicit wiring.
* Avoid autowiring for a bean definition by setting its `autowire-candidate` attributes
to `false`, as described in the xref:core/beans/dependencies/factory-autowire.adoc#beans-factory-autowire-candidate[next section].
to `false`, as described in the
xref:core/beans/dependencies/factory-autowire.adoc#beans-factory-autowire-candidate[next section].
* Designate a single bean definition as the primary candidate by setting the
`primary` attribute of its `<bean/>` element to `true`.
* Implement the more fine-grained control available with annotation-based configuration,
as described in xref:core/beans/annotation-config.adoc[Annotation-based Container Configuration].
[[beans-factory-autowire-candidate]]
== Excluding a Bean from Autowiring
@@ -139,6 +139,3 @@ get injected by plain declared type only, rather by type plus specific qualifier
In contrast, `autowireCandidate=false` behaves exactly like the `autowire-candidate`
attribute as explained above: Such a bean will never get injected by type at all.
====
@@ -16,8 +16,9 @@ not know the location or class of the dependencies. As a result, your classes be
to test, particularly when the dependencies are on interfaces or abstract base classes,
which allow for stub or mock implementations to be used in unit tests.
DI exists in two major variants: xref:core/beans/dependencies/factory-collaborators.adoc#beans-constructor-injection[Constructor-based dependency injection]
and xref:core/beans/dependencies/factory-collaborators.adoc#beans-setter-injection[Setter-based dependency injection].
DI exists in two major variants:
xref:core/beans/dependencies/factory-collaborators.adoc#beans-constructor-injection[Constructor-based dependency injection]
and xref:core/beans/dependencies/factory-collaborators.adoc#beans-setter-injection[Setter-based dependency injection].
[[beans-constructor-injection]]
@@ -606,6 +607,3 @@ contains the `static` factory method (although, in this example, it is). An inst
(non-static) factory method can be used in an essentially identical fashion (aside
from the use of the `factory-bean` attribute instead of the `class` attribute), so we
do not discuss those details here.
@@ -37,6 +37,3 @@ in the case of xref:core/beans/factory-scopes.adoc#beans-factory-scopes-singleto
beans only, a corresponding destruction-time dependency. Dependent beans that define a
`depends-on` relationship with a given bean are destroyed first, prior to the given bean
itself being destroyed. Thus, `depends-on` can also control shutdown order.
@@ -29,6 +29,3 @@ annotated class or in XML using the `default-lazy-init` attribute on the `<beans
shows:
include-code::./LazyConfiguration[tag=snippet,indent=0]
@@ -2,16 +2,17 @@
= Method Injection
In most application scenarios, most beans in the container are
xref:core/beans/factory-scopes.adoc#beans-factory-scopes-singleton[singletons]. When a singleton bean needs to
collaborate with another singleton bean or a non-singleton bean needs to collaborate
with another non-singleton bean, you typically handle the dependency by defining one
bean as a property of the other. A problem arises when the bean lifecycles are
different. Suppose singleton bean A needs to use non-singleton (prototype) bean B,
xref:core/beans/factory-scopes.adoc#beans-factory-scopes-singleton[singletons]. When a
singleton bean needs to collaborate with another singleton bean or a non-singleton bean
needs to collaborate with another non-singleton bean, you typically handle the dependency
by defining one bean as a property of the other. A problem arises when the bean lifecycles
are different. Suppose singleton bean A needs to use non-singleton (prototype) bean B,
perhaps on each method invocation on A. The container creates the singleton bean A only
once, and thus only gets one opportunity to set the properties. The container cannot
provide bean A with a new instance of bean B every time one is needed.
A solution is to forego some inversion of control. You can xref:core/beans/factory-nature.adoc#beans-factory-aware[make bean A aware of the container]
A solution is to forego some inversion of control. You can
xref:core/beans/factory-nature.adoc#beans-factory-aware[make bean A aware of the container]
by implementing the `ApplicationContextAware` interface,
and by xref:core/beans/basics.adoc#beans-factory-client[making a `getBean("B")` call to the container] ask for (a
typically new) bean B instance every time bean A needs it. The following example
@@ -103,7 +104,6 @@ You can read more about the motivation for Method Injection in
****
[[beans-factory-lookup-method-injection]]
== Lookup Method Injection
@@ -294,14 +294,14 @@ Kotlin::
[TIP]
====
Another way of accessing differently scoped target beans is an `ObjectFactory`/
`Provider` injection point. See xref:core/beans/factory-scopes.adoc#beans-factory-scopes-other-injection[Scoped Beans as Dependencies].
`Provider` injection point. See
xref:core/beans/factory-scopes.adoc#beans-factory-scopes-other-injection[Scoped Beans as Dependencies].
You may also find the `ServiceLocatorFactoryBean` (in the
`org.springframework.beans.factory.config` package) to be useful.
====
[[beans-factory-arbitrary-method-replacement]]
== Arbitrary Method Replacement
@@ -422,6 +422,3 @@ substring of the fully qualified type name. For example, the following all match
Because the number of arguments is often enough to distinguish between each possible
choice, this shortcut can save a lot of typing, by letting you type only the
shortest string that matches an argument type.
@@ -1,11 +1,10 @@
[[beans-factory-properties-detailed]]
= Dependencies and Configuration in Detail
As mentioned in the xref:core/beans/dependencies/factory-collaborators.adoc[previous section], you can define bean
properties and constructor arguments as references to other managed beans (collaborators)
or as values defined inline. Spring's XML-based configuration metadata supports
sub-element types within its `<property/>` and `<constructor-arg/>` elements for this
purpose.
As mentioned in the xref:core/beans/dependencies/factory-collaborators.adoc[previous section],
you can define bean properties and constructor arguments as references to other managed beans
(collaborators) or as values defined inline. Spring's XML-based configuration metadata supports
sub-element types within its `<property/>` and `<constructor-arg/>` elements for this purpose.
[[beans-value-element]]
@@ -51,9 +50,8 @@ XML configuration:
The preceding XML is more succinct. However, typos are discovered at runtime rather than
design time, unless you use an IDE (such as https://www.jetbrains.com/idea/[IntelliJ
IDEA] or the {spring-site-tools}[Spring Tools for Eclipse])
that supports automatic property completion when you create bean definitions. Such IDE
assistance is highly recommended.
IDEA] or the {spring-site-tools}[Spring Tools]) that supports automatic property
completion when you create bean definitions. Such IDE assistance is highly recommended.
You can also configure a `java.util.Properties` instance, as follows:
@@ -86,11 +84,11 @@ element. The following example shows how to use it:
[source,xml,indent=0,subs="verbatim,quotes"]
----
<bean id="theTargetBean" class="..."/>
<bean id="collaborator" class="..." />
<bean id="theClientBean" class="...">
<bean id="client" class="...">
<property name="targetName">
<idref bean="theTargetBean"/>
<idref bean="collaborator" />
</property>
</bean>
----
@@ -100,28 +98,24 @@ following snippet:
[source,xml,indent=0,subs="verbatim,quotes"]
----
<bean id="theTargetBean" class="..." />
<bean id="collaborator" class="..." />
<bean id="theClientBean" class="...">
<property name="targetName" ref="theTargetBean"/>
<bean id="client" class="...">
<property name="targetName" value="collaborator" />
</bean>
----
The first form is preferable to the second, because using the `idref` tag lets the
container validate at deployment time that the referenced, named bean actually
exists. In the second variation, no validation is performed on the value that is passed
to the `targetName` property of the `client` bean. Typos are only discovered (with most
container validate at deployment time that the referenced, named bean actually exists. In
the second variation, no validation is performed on the value that is passed to the
`targetName` property of the `client` bean. Typos are therefore only discovered (with most
likely fatal results) when the `client` bean is actually instantiated. If the `client`
bean is a xref:core/beans/factory-scopes.adoc[prototype] bean, this typo and the resulting exception
may only be discovered long after the container is deployed.
bean is a xref:core/beans/factory-scopes.adoc[prototype] bean, this typo and the resulting
exception may only be discovered long after the container is deployed.
NOTE: The `local` attribute on the `idref` element is no longer supported in the 4.0 beans
XSD, since it does not provide value over a regular `bean` reference any more. Change
your existing `idref local` references to `idref bean` when upgrading to the 4.0 schema.
A common place (at least in versions earlier than Spring 2.0) where the `<idref/>` element
brings value is in the configuration of xref:core/aop-api/pfb.adoc#aop-pfb-1[AOP interceptors] in a
`ProxyFactoryBean` bean definition. Using `<idref/>` elements when you specify the
NOTE: A common place (at least in versions earlier than Spring 2.0) where the `<idref/>`
element brings value is in the configuration of xref:core/aop-api/pfb.adoc#aop-pfb-1[AOP interceptors]
in a `ProxyFactoryBean` bean definition. Using `<idref/>` elements when you specify the
interceptor names prevents you from misspelling an interceptor ID.
@@ -544,9 +538,10 @@ three approaches at the same time.
[[beans-c-namespace]]
== XML Shortcut with the c-namespace
Similar to the xref:core/beans/dependencies/factory-properties-detailed.adoc#beans-p-namespace[XML Shortcut with the p-namespace], the c-namespace, introduced in Spring
3.1, allows inlined attributes for configuring the constructor arguments rather
then nested `constructor-arg` elements.
Similar to the
xref:core/beans/dependencies/factory-properties-detailed.adoc#beans-p-namespace[XML Shortcut with the p-namespace],
the c-namespace, introduced in Spring 3.1, allows inlined attributes for configuring
the constructor arguments rather then nested `constructor-arg` elements.
The following example uses the `c:` namespace to do the same thing as the from
xref:core/beans/dependencies/factory-collaborators.adoc#beans-constructor-injection[Constructor-based Dependency Injection]:
@@ -598,9 +593,9 @@ A corresponding index notation is also available for `<constructor-arg>` element
not commonly used since the plain order of declaration is usually sufficient there.
In practice, the constructor resolution
xref:core/beans/dependencies/factory-collaborators.adoc#beans-factory-ctor-arguments-resolution[mechanism] is quite efficient in matching
arguments, so unless you really need to, we recommend using the name notation
throughout your configuration.
xref:core/beans/dependencies/factory-collaborators.adoc#beans-factory-ctor-arguments-resolution[mechanism]
is quite efficient in matching arguments, so unless you really need to, we recommend
using the name notation throughout your configuration.
[[beans-compound-property-names]]
@@ -621,6 +616,3 @@ The `something` bean has a `fred` property, which has a `bob` property, which ha
property, and that final `sammy` property is being set to a value of `123`. In order for
this to work, the `fred` property of `something` and the `bob` property of `fred` must not
be `null` after the bean is constructed. Otherwise, a `NullPointerException` is thrown.
@@ -20,7 +20,6 @@ user with a convenient service interface for configuring property sources and re
properties from them.
[[beans-definition-profiles]]
== Bean Definition Profiles
@@ -114,7 +113,6 @@ certain contexts but not in others. You could say that you want to register a
certain profile of bean definitions in situation A and a different profile in
situation B. We start by updating our configuration to reflect this need.
[[beans-definition-profiles-java]]
=== Using `@Profile`
@@ -345,7 +343,6 @@ way to represent such an arrangement in a valid Java class in the first place
(since there can only be one method of a particular name and argument signature).
====
[[beans-definition-profiles-xml]]
=== XML Bean Definition Profiles
@@ -437,7 +434,6 @@ In the preceding example, the `dataSource` bean is exposed if both the `producti
`us-east` profiles are active.
=====
[[beans-definition-profiles-enable]]
=== Activating a Profile
@@ -512,7 +508,6 @@ as the following example shows:
-Dspring.profiles.active="profile1,profile2"
----
[[beans-definition-profiles-default]]
=== Default Profile
@@ -567,7 +562,6 @@ the default profile by using `setDefaultProfiles()` on the `Environment` or,
declaratively, by using the `spring.profiles.default` property.
[[beans-property-source-abstraction]]
== `PropertySource` Abstraction
@@ -668,7 +662,6 @@ API exposes a number of methods that allow for precise manipulation of the set o
property sources.
[[beans-using-propertysource]]
== Using `@PropertySource`
@@ -777,7 +770,6 @@ may also be used as a meta-annotation to create custom composed annotations with
attribute overrides.
[[beans-placeholder-resolution-in-statements]]
== Placeholder Resolution in Statements
@@ -798,7 +790,3 @@ property is defined, as long as it is available in the `Environment`:
<import resource="com/bank/service/${customer}-config.xml"/>
</beans>
----
@@ -7,7 +7,6 @@ implementations of special integration interfaces. The next few sections describ
integration interfaces.
[[beans-factory-extension-bpp]]
== Customizing Beans by Using a `BeanPostProcessor`
@@ -68,6 +67,13 @@ interface, clearly indicating the post-processor nature of that bean. Otherwise,
Since a `BeanPostProcessor` needs to be instantiated early in order to apply to the
initialization of other beans in the context, this early type detection is critical.
Furthermore, when registering a `BeanPostProcessor` via an `@Bean` factory method,
declare the method as `static` and ideally with no dependencies. Doing so avoids eager
initialization of the configuration class and other beans, which would make them
ineligible for full post-processing (such as auto-proxying). See the
"BeanPostProcessor-returning `@Bean` methods" section in the
{spring-framework-api}/context/annotation/Bean.html[`@Bean`] javadoc for details.
[[beans-factory-programmatically-registering-beanpostprocessors]]
.Programmatically registering `BeanPostProcessor` instances
NOTE: While the recommended approach for `BeanPostProcessor` registration is through
@@ -81,7 +87,7 @@ of execution. Note also that `BeanPostProcessor` instances registered programmat
are always processed before those registered through auto-detection, regardless of any
explicit ordering.
.`BeanPostProcessor` instances and AOP auto-proxying
.`BeanPostProcessor` instances and early initialization
[NOTE]
====
Classes that implement the `BeanPostProcessor` interface are special and are treated
@@ -91,17 +97,23 @@ of the `ApplicationContext`. Next, all `BeanPostProcessor` instances are registe
in a sorted fashion and applied to all further beans in the container. Because AOP
auto-proxying is implemented as a `BeanPostProcessor` itself, neither `BeanPostProcessor`
instances nor the beans they directly reference are eligible for auto-proxying and,
thus, do not have aspects woven into them.
thus, do not have aspects woven into them. More generally, any bean that is instantiated
during this early phase is not eligible for full post-processing by all
`BeanPostProcessor` instances.
For any such bean, you should see an informational log message: `Bean someBean is not
eligible for getting processed by all BeanPostProcessor interfaces (for example: not
eligible for auto-proxying)`.
For any such bean, you should see a WARN-level log message similar to the following.
If you have beans wired into your `BeanPostProcessor` by using autowiring or
`@Resource` (which may fall back to autowiring), Spring might access unexpected beans
when searching for type-matching dependency candidates and, therefore, make them
ineligible for auto-proxying or other kinds of bean post-processing. For example, if you
have a dependency annotated with `@Resource` where the field or setter name does not
[quote]
Bean 'someBean' of type [org.example.SomeType] is not eligible for getting processed by
all BeanPostProcessors (for example: not eligible for auto-proxying).
To minimize the number of beans affected, register a `BeanPostProcessor` with a
`static` `@Bean` method that has no dependencies (see the note above). If you have
beans wired into your `BeanPostProcessor` by using autowiring or `@Resource` (which
may fall back to autowiring), Spring might access unexpected beans when searching
for type-matching dependency candidates and, therefore, make them ineligible for
auto-proxying or other kinds of bean post-processing. For example, if you have a
dependency annotated with `@Resource` where the field or setter name does not
directly correspond to the declared name of a bean and no name attribute is used,
Spring accesses other beans for matching them by type.
====
@@ -109,7 +121,6 @@ Spring accesses other beans for matching them by type.
The following examples show how to write, register, and use `BeanPostProcessor` instances
in an `ApplicationContext`.
[[beans-factory-extension-bpp-examples-hw]]
=== Example: Hello World, `BeanPostProcessor`-style
@@ -137,7 +148,7 @@ Java::
}
public Object postProcessAfterInitialization(Object bean, String beanName) {
System.out.println("Bean '" + beanName + "' created : " + bean.toString());
System.out.println("Bean '" + beanName + "' created : " + bean);
return bean;
}
}
@@ -166,7 +177,48 @@ Kotlin::
----
======
The following `beans` element uses the `InstantiationTracingBeanPostProcessor`:
You can register the `InstantiationTracingBeanPostProcessor` with Java configuration
by using a `static` `@Bean` method (recommended to avoid eager initialization of the
configuration class and other beans):
[tabs]
======
Java::
+
[source,java,indent=0,subs="verbatim,quotes",chomp="-packages"]
----
@Configuration
public class AppConfig {
@Bean
public static InstantiationTracingBeanPostProcessor instantiationTracingBeanPostProcessor() {
return new InstantiationTracingBeanPostProcessor();
}
// ... other bean definitions
}
----
Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",chomp="-packages"]
----
@Configuration
class AppConfig {
@Bean
companion object {
@JvmStatic
fun instantiationTracingBeanPostProcessor() = InstantiationTracingBeanPostProcessor()
}
// ... other bean definitions
}
----
======
Alternatively, the `InstantiationTracingBeanPostProcessor` can be registered via the
`bean` element with XML configuration:
[source,xml,indent=0,subs="verbatim,quotes"]
----
@@ -194,7 +246,7 @@ The following `beans` element uses the `InstantiationTracingBeanPostProcessor`:
----
Notice how the `InstantiationTracingBeanPostProcessor` is merely defined. It does not
even have a name, and, because it is a bean, it can be dependency-injected as you would any
even have a name, and, because it is a bean, it can be dependency-injected as with any
other bean. (The preceding configuration also defines a bean that is backed by a Groovy
script. The Spring dynamic language support is detailed in the chapter entitled
xref:languages/dynamic.adoc[Dynamic Language Support].)
@@ -226,7 +278,7 @@ Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
----
import org.springframework.beans.factory.getBean
import org.springframework.beans.factory.getBean
fun main() {
val ctx = ClassPathXmlApplicationContext("scripting/beans.xml")
@@ -244,7 +296,6 @@ Bean 'messenger' created : org.springframework.scripting.groovy.GroovyMessenger@
org.springframework.scripting.groovy.GroovyMessenger@272961
----
[[beans-factory-extension-bpp-examples-aabpp]]
=== Example: The `AutowiredAnnotationBeanPostProcessor`
@@ -255,7 +306,6 @@ that ships with the Spring distribution and autowires annotated fields, setter m
and arbitrary config methods.
[[beans-factory-extension-factory-postprocessors]]
== Customizing Configuration Metadata with a `BeanFactoryPostProcessor`
@@ -305,6 +355,23 @@ implement the `BeanFactoryPostProcessor` interface. It uses these beans as bean
post-processors, at the appropriate time. You can deploy these post-processor beans as
you would any other bean.
When registering a `BeanFactoryPostProcessor` via an `@Bean` factory method in a
`@Configuration` class, declare the method as `static` to avoid lifecycle conflicts
with annotation processing (such as `@Autowired`, `@Value`, and `@PostConstruct`) in the
configuration class. See the "BeanFactoryPostProcessor-returning `@Bean` methods"
section in the {spring-framework-api}/context/annotation/Bean.html[`@Bean`] javadoc
for details and an example.
For any non-static `@Bean` factory method with a `BeanFactoryPostProcessor` return type,
you should see an INFO-level log message similar to the following.
[quote]
@Bean method MyConfig.myBfpp is non-static and returns an object assignable to Spring's
BeanFactoryPostProcessor interface. This will result in a failure to process annotations
such as @Autowired, @Resource, and @PostConstruct within the method's declaring
@Configuration class. Add the 'static' modifier to this method to avoid these container
lifecycle issues; see @Bean javadoc for complete details.
NOTE: As with ``BeanPostProcessor``s , you typically do not want to configure
``BeanFactoryPostProcessor``s for lazy initialization. If no other bean references a
`Bean(Factory)PostProcessor`, that post-processor will not get instantiated at all.
@@ -312,9 +379,8 @@ Thus, marking it for lazy initialization will be ignored, and the
`Bean(Factory)PostProcessor` will be instantiated eagerly even if you set the
`default-lazy-init` attribute to `true` on the declaration of your `<beans />` element.
[[beans-factory-placeholderconfigurer]]
=== Example: The Class Name Substitution `PropertySourcesPlaceholderConfigurer`
=== Example: Property Placeholder Substitution with `PropertySourcesPlaceholderConfigurer`
You can use the `PropertySourcesPlaceholderConfigurer` to externalize property values
from a bean definition in a separate file by using the standard Java `Properties` format.
@@ -341,8 +407,8 @@ with placeholder values is defined:
The example shows properties configured from an external `Properties` file. At runtime,
a `PropertySourcesPlaceholderConfigurer` is applied to the metadata that replaces some
properties of the DataSource. The values to replace are specified as placeholders of the
form pass:q[`${property-name}`], which follows the Ant and log4j and JSP EL style.
properties of the `DataSource`. The values to replace are specified as placeholders of the
form pass:q[`${property-name}`], which follows the Ant, log4j, and JSP EL style.
The actual values come from another file in the standard Java `Properties` format:
@@ -355,11 +421,15 @@ jdbc.password=root
----
Therefore, the `${jdbc.username}` string is replaced at runtime with the value, 'sa', and
the same applies for other placeholder values that match keys in the properties file.
The `PropertySourcesPlaceholderConfigurer` checks for placeholders in most properties and
attributes of a bean definition. Furthermore, you can customize the placeholder prefix and suffix.
the same applies for other placeholder values that match keys in the properties file. The
`PropertySourcesPlaceholderConfigurer` checks for placeholders in most properties and
attributes of a bean definition. Furthermore, you can customize the placeholder prefix,
suffix, default value separator, and escape character. In addition, the default escape
character can be changed or disabled globally by setting the
`spring.placeholder.escapeCharacter.default` property via a JVM system property (or via
the xref:appendix.adoc#appendix-spring-properties[`SpringProperties`] mechanism).
With the `context` namespace introduced in Spring 2.5, you can configure property placeholders
With the `context` namespace, you can configure property placeholders
with a dedicated configuration element. You can provide one or more locations as a
comma-separated list in the `location` attribute, as the following example shows:
@@ -408,7 +478,6 @@ fails when it is about to be created, which is during the `preInstantiateSinglet
phase of an `ApplicationContext` for a non-lazy-init bean.
=====
[[beans-factory-overrideconfigurer]]
=== Example: The `PropertyOverrideConfigurer`
@@ -465,7 +534,6 @@ property overriding with a dedicated configuration element, as the following exa
----
[[beans-factory-extension-factorybean]]
== Customizing Instantiation Logic with a `FactoryBean`
@@ -498,6 +566,3 @@ calling the `getBean()` method of the `ApplicationContext`. So, for a given `Fac
with an `id` of `myBean`, invoking `getBean("myBean")` on the container returns the
product of the `FactoryBean`, whereas invoking `getBean("&myBean")` returns the
`FactoryBean` instance itself.
@@ -9,7 +9,6 @@ of a bean. This section groups them as follows:
* xref:core/beans/factory-nature.adoc#aware-list[Other `Aware` Interfaces]
[[beans-factory-lifecycle]]
== Lifecycle Callbacks
@@ -41,8 +40,6 @@ startup and shutdown process, as driven by the container's own lifecycle.
The lifecycle callback interfaces are described in this section.
[[beans-factory-lifecycle-initializingbean]]
=== Initialization Callbacks
@@ -156,8 +153,6 @@ the container's overall lifecycle management, including an auto-startup mechanis
a pre-destroy stop step, and potential stop/restart callbacks (see below).
====
[[beans-factory-lifecycle-disposablebean]]
=== Destruction Callbacks
@@ -267,8 +262,6 @@ You may also implement `SmartLifecycle` for a time-bound stop step where the con
will wait for all such stop processing to complete before moving on to destroy methods.
====
[[beans-factory-lifecycle-default-init-destroy-methods]]
=== Default Initialization and Destroy Methods
@@ -369,8 +362,6 @@ interceptors to the `init` method, because doing so would couple the lifecycle o
target bean to its proxy or interceptors and leave strange semantics when your code
interacts directly with the raw target bean.
[[beans-factory-lifecycle-combined-effects]]
=== Combining Lifecycle Mechanisms
@@ -402,8 +393,6 @@ Destroy methods are called in the same order:
. `destroy()` as defined by the `DisposableBean` callback interface
. A custom configured `destroy()` method
[[beans-factory-lifecycle-processor]]
=== Startup and Shutdown Callbacks
@@ -526,8 +515,6 @@ its own `start()` method (unlike the context refresh, the context start does not
automatically for a standard context implementation). The `phase` value and any
"`depends-on`" relationships determine the startup order as described earlier.
[[beans-factory-shutdown]]
=== Shutting Down the Spring IoC Container Gracefully in Non-Web Applications
@@ -590,8 +577,6 @@ Kotlin::
----
======
[[beans-factory-thread-safety]]
=== Thread Safety and Visibility
@@ -625,7 +610,6 @@ destroy callback without a preceding stop since this may happen during an extrao
shutdown after a cancelled bootstrap or in case of a stop timeout caused by another bean.
[[beans-factory-aware]]
== `ApplicationContextAware` and `BeanNameAware`
@@ -682,7 +666,6 @@ initialization callback such as `InitializingBean.afterPropertiesSet()` or a cus
init-method.
[[aware-list]]
== Other `Aware` Interfaces
@@ -747,6 +730,3 @@ dependency type. The following table summarizes the most important `Aware` inter
Note again that using these interfaces ties your code to the Spring API and does not
follow the Inversion of Control style. As a result, we recommend them for infrastructure
beans that require programmatic access to the container.
@@ -56,7 +56,6 @@ For instructions on how to register this or any other custom scope, see
xref:core/beans/factory-scopes.adoc#beans-factory-scopes-custom-using[Using a Custom Scope].
[[beans-factory-scopes-singleton]]
== The Singleton Scope
@@ -91,7 +90,6 @@ following example:
----
[[beans-factory-scopes-prototype]]
== The Prototype Scope
@@ -134,7 +132,6 @@ be handled by the client. (For details on the lifecycle of a bean in the Spring
container, see xref:core/beans/factory-nature.adoc#beans-factory-lifecycle[Lifecycle Callbacks].)
[[beans-factory-scopes-sing-prot-interaction]]
== Singleton Beans with Prototype-bean Dependencies
@@ -152,7 +149,6 @@ and injects its dependencies. If you need a new instance of a prototype bean at
runtime more than once, see xref:core/beans/dependencies/factory-method-injection.adoc[Method Injection].
[[beans-factory-scopes-other]]
== Request, Session, Application, and WebSocket Scopes
@@ -162,8 +158,6 @@ if you use a web-aware Spring `ApplicationContext` implementation (such as
such as the `ClassPathXmlApplicationContext`, an `IllegalStateException` that complains
about an unknown bean scope is thrown.
[[beans-factory-scopes-other-web-configuration]]
=== Initial Web Configuration
@@ -223,8 +217,6 @@ the same thing, namely bind the HTTP request object to the `Thread` that is serv
that request. This makes beans that are request- and session-scoped available further
down the call chain.
[[beans-factory-scopes-request]]
=== Request scope
@@ -272,8 +264,6 @@ Kotlin::
----
======
[[beans-factory-scopes-session]]
=== Session Scope
@@ -322,8 +312,6 @@ Kotlin::
----
======
[[beans-factory-scopes-application]]
=== Application Scope
@@ -371,8 +359,6 @@ Kotlin::
----
======
[[beans-factory-scopes-websocket]]
=== WebSocket Scope
@@ -380,8 +366,6 @@ WebSocket scope is associated with the lifecycle of a WebSocket session and appl
STOMP over WebSocket applications, see
xref:web/websocket/stomp/scope.adoc[WebSocket scope] for more details.
[[beans-factory-scopes-other-injection]]
=== Scoped Beans as Dependencies
@@ -539,8 +523,6 @@ interfaces. The following example shows a proxy based on an interface:
For more detailed information about choosing class-based or interface-based proxying,
see xref:core/aop/proxying.adoc[Proxying Mechanisms].
[[beans-factory-scopes-injection]]
=== Injecting Request/Session References Directly
@@ -553,7 +535,6 @@ objects which has the advantage of working in singleton beans and serializable b
as well, similar to scoped proxies for factory-scoped beans.
[[beans-factory-scopes-custom]]
== Custom Scopes
@@ -561,7 +542,6 @@ The bean scoping mechanism is extensible. You can define your own
scopes or even redefine existing scopes, although the latter is considered bad practice
and you cannot override the built-in `singleton` and `prototype` scopes.
[[beans-factory-scopes-custom-creating]]
=== Creating a Custom Scope
@@ -664,8 +644,6 @@ Kotlin::
This identifier is different for each scope. For a session scoped implementation, this
identifier can be the session identifier.
[[beans-factory-scopes-custom-using]]
=== Using a Custom Scope
@@ -773,7 +751,3 @@ of the scope. You can also do the `Scope` registration declaratively, by using t
NOTE: When you place `<aop:scoped-proxy/>` within a `<bean>` declaration for a
`FactoryBean` implementation, it is the factory bean itself that is scoped, not the object
returned from `getObject()`.
@@ -37,7 +37,3 @@ by the Spring IoC container are called beans. A bean is an object that is
instantiated, assembled, and managed by a Spring IoC container. Otherwise, a
bean is simply one of many objects in your application. Beans, and the dependencies
among them, are reflected in the configuration metadata used by a container.
@@ -4,4 +4,3 @@
This section covers how to use annotations in your Java code to configure the Spring
container.
@@ -84,6 +84,3 @@ subclassing has to be applied at runtime, reducing the overhead and the footprin
The `@Bean` and `@Configuration` annotations are discussed in depth in the following sections.
First, however, we cover the various ways of creating a Spring container by using
Java-based configuration.
@@ -468,6 +468,7 @@ Kotlin::
----
======
[[beans-java-customizing-bean-naming]]
== Customizing Bean Naming
@@ -585,6 +586,3 @@ Kotlin::
}
----
======
@@ -339,11 +339,11 @@ In the preceding scenario, using `@Autowired` works well and provides the desire
modularity, but determining exactly where the autowired bean definitions are declared is
still somewhat ambiguous. For example, as a developer looking at `ServiceConfig`, how do
you know exactly where the `@Autowired AccountRepository` bean is declared? It is not
explicit in the code, and this may be just fine. Remember that the
{spring-site-tools}[Spring Tools for Eclipse] provides tooling that
can render graphs showing how everything is wired, which may be all you need. Also,
your Java IDE can easily find all declarations and uses of the `AccountRepository` type
and quickly show you the location of `@Bean` methods that return that type.
explicit in the code, and this may be just fine. Note that the
{spring-site-tools}[Spring Tools] IDE support provides tooling that can render graphs
showing how everything is wired, which may be all you need. Also, your Java IDE can
easily find all declarations and uses of the `AccountRepository` type and quickly show
you the location of `@Bean` methods that return that type.
In cases where this ambiguity is not acceptable and you wish to have direct navigation
from within your IDE from one `@Configuration` class to another, consider autowiring the
@@ -905,4 +905,3 @@ Kotlin::
}
----
======
@@ -4,7 +4,9 @@
`@Configuration` is a class-level annotation indicating that an object is a source of
bean definitions. `@Configuration` classes declare beans through `@Bean`-annotated
methods. Calls to `@Bean` methods on `@Configuration` classes can also be used to define
inter-bean dependencies. See xref:core/beans/java/basic-concepts.adoc[Basic Concepts: `@Bean` and `@Configuration`] for a general introduction.
inter-bean dependencies. See
xref:core/beans/java/basic-concepts.adoc[Basic Concepts: `@Bean` and `@Configuration`]
for a general introduction.
[[beans-java-injecting-dependencies]]
@@ -58,7 +60,6 @@ is declared within a `@Configuration` class. You cannot declare inter-bean depen
by using plain `@Component` classes.
[[beans-java-method-injection]]
== Lookup Method Injection
@@ -259,6 +260,3 @@ instead) or by annotating your configuration class with
are then not intercepted, so you have to exclusively rely on dependency injection at the
constructor or method level there.
====
@@ -206,7 +206,8 @@ Kotlin::
----
======
NOTE: Remember that `@Configuration` classes are xref:core/beans/classpath-scanning.adoc#beans-meta-annotations[meta-annotated]
NOTE: Remember that `@Configuration` classes are
xref:core/beans/classpath-scanning.adoc#beans-meta-annotations[meta-annotated]
with `@Component`, so they are candidates for component-scanning. In the preceding example,
assuming that `AppConfig` is declared within the `com.acme` package (or any package
underneath), it is picked up during the call to `scan()`. Upon `refresh()`, all its `@Bean`
@@ -280,5 +281,3 @@ NOTE: For programmatic use cases, a `GenericWebApplicationContext` can be used a
alternative to `AnnotationConfigWebApplicationContext`. See the
{spring-framework-api}/web/context/support/GenericWebApplicationContext.html[`GenericWebApplicationContext`]
javadoc for details.
@@ -23,7 +23,6 @@ You can add the following dependency to your file pom.xml:
=====
[[beans-inject-named]]
== Dependency Injection with `@Inject` and `@Named`
@@ -214,7 +213,6 @@ Kotlin::
======
[[beans-named]]
== `@Named` and `@ManagedBean`: Standard Equivalents to the `@Component` Annotation
@@ -339,7 +337,6 @@ annotations are not composable. You should use Spring's stereotype model for bui
custom component annotations.
[[beans-standard-annotations-limitations]]
== Limitations of JSR-330 Standard Annotations
@@ -388,6 +385,3 @@ features are not available, as the following table shows:
only with a shorter `get()` method name. It can also be used in combination with
Spring's `@Autowired` or with non-annotated constructors and setter methods.
|===

Some files were not shown because too many files have changed in this diff Show More