Commit Graph

31293 Commits

Author SHA1 Message Date
Sam Brannen 0e8316e704 Add value attribute alias to @⁠MockitoBean and @⁠MockitoSpyBean
This commit improves the user experience for common use cases by
introducing new `value` attributes in @⁠MockitoBean and
@⁠MockitoSpyBean that are aliases for the existing `name` attributes.

For example, this allows developers to declare
@⁠MockitoBean("userService") instead of @⁠MockitoBean(name =
"userService"), analogous to the existing name/value alias support in
@⁠TestBean.

Closes gh-33680
2024-10-10 13:05:39 +02:00
Sam Brannen 1b8f2c46c1 Update Javadoc for @⁠Mockito[Spy]Bean to reflect current semantics 2024-10-10 12:19:36 +02:00
Sam Brannen f7e32a9c78 Revise singleton destruction for Bean Overrides
See gh-33678
2024-10-10 12:13:44 +02:00
Sam Brannen 8d652e9c12 Reinstate Bean Override support for replacing a manually registered singleton
Closes gh-33678
2024-10-09 18:10:07 +02:00
Sam Brannen c70a6d3be1 Fix test method names 2024-10-09 17:17:57 +02:00
Sam Brannen 1afcb22205 Change enforceOverride flag to false in @⁠TestBean and @⁠MockitoBean
Based on feedback from the Spring Boot team, we have decided to change
the default values for the enforceOverride flags in @⁠TestBean and
@⁠MockitoBean from true to false.

Closes gh-33613
2024-10-09 17:08:58 +02:00
Sam Brannen 381b16fba2 Simplify Bean Override field injection logic
This commit simplifies the field injection logic for Bean Overrides in
order to align with the semantics of the core container and the Spring
TestContext Framework.

Closes gh-33677
2024-10-09 15:43:32 +02:00
Sam Brannen 4758424f6c Clean up warnings in Gradle build 2024-10-09 15:43:32 +02:00
Sam Brannen 7c3624318b Polish Mockito TestExecutionListeners 2024-10-09 15:43:32 +02:00
Sam Brannen 461f1724b7 Colocate nonexistent bean definition processing for Bean Overrides 2024-10-09 15:43:32 +02:00
Sam Brannen b5c82b8dcb Reject bean names with factory prefix for Bean Overrides
Closes gh-33674
2024-10-09 15:43:32 +02:00
Sam Brannen c864afd6fe Polishing 2024-10-09 15:43:32 +02:00
Stéphane Nicoll f54fabad8f Merge pull request #33669 from Seungpang
* pr/33669:
  Polish "Reject empty strings in DurationFormatterUtils"
  Reject empty strings in DurationFormatterUtils

Closes gh-33669
2024-10-09 15:27:59 +02:00
Stéphane Nicoll e2238c0211 Polish "Reject empty strings in DurationFormatterUtils"
See gh-33669
2024-10-09 15:26:09 +02:00
Seungrae 02c990ca82 Reject empty strings in DurationFormatterUtils
See gh-33669
2024-10-09 15:20:11 +02:00
Stéphane Nicoll 7f7f65cfcb Merge branch '6.1.x' 2024-10-09 14:44:38 +02:00
Stéphane Nicoll f991c19b30 Merge pull request #33617 from asibross
* pr/33617:
  Polish "Adapt Javadoc note about log level of BeanPostProcessorChecker"
  Adapt Javadoc note about log level of BeanPostProcessorChecker

Closes gh-33617
2024-10-09 14:44:32 +02:00
Stéphane Nicoll 3c80d4c978 Polish "Adapt Javadoc note about log level of BeanPostProcessorChecker"
See gh-33617
2024-10-09 14:42:36 +02:00
Asi Bross 6da32b4631 Adapt Javadoc note about log level of BeanPostProcessorChecker
See gh-33617
2024-10-09 14:40:49 +02:00
rstoyanchev 8520fa5e2a Reduce warnings in WhatWgUrlParser 2024-10-09 13:29:49 +01:00
rstoyanchev f4967f202e Revise URI template handling in WhatWgUrlParser
Closes gh-33673
2024-10-09 13:29:49 +01:00
rstoyanchev 1f4743af54 Lenient handling of malformed query in ServletServerHttpRequest
Closes gh-30489
2024-10-09 13:29:49 +01:00
Stéphane Nicoll af85d1997b Merge branch '6.1.x' 2024-10-09 14:25:26 +02:00
Stéphane Nicoll 6677d452e7 Start building against Micrometer 1.14.0-RC1 snapshots
See gh-33648
2024-10-09 14:19:35 +02:00
Stéphane Nicoll 91cadf7f24 Start building against Reactor 2023.0.11 snapshots
See gh-33637
2024-10-09 14:16:14 +02:00
Stéphane Nicoll 90637b6344 Start building against Micrometer 1.12.11 snapshots
See gh-33647
2024-10-09 14:15:22 +02:00
Simon Baslé ef77b4064f Keep DefaultServerHttpRequestBuilder-mutated headers case-insensitive
This change avoids the trap of creating a copy of `HttpHeaders` using a
case-sensitive `MultiValueMap` by mistake. Since mutability is always
desirable, we make a mutable copy by using `addAll` on an empty
`HttpHeaders`.

We can't simply rely on HttpHeaders' map-based constructor to detect
read-only header in this particular case, because the container's
original headers representation might in some cases be read-only.

Closes gh-33666
2024-10-09 11:39:33 +02:00
Sam Brannen 59ef5e140f Update warning for use of convention-based annotation attribute overrides
See gh-28761
2024-10-09 10:03:22 +02:00
Sam Brannen e1c450d253 Support Bean Overrides with AOT and native image
This set of commits introduces AOT and native image support for the new
Bean Override feature in the Spring TestContext Framework -- for
example, for using @⁠TestBean and @⁠MockitoBean in AOT mode on the JVM
as well as in a GraalVM native image.

Note, however, that @⁠MockitoBean has currently only been tested in a
native image when mocking interfaces and using Mockito's
ProxyMockMaker, along with a custom runtime hints.

Closes gh-32933
2024-10-08 17:57:21 +02:00
Sam Brannen 65d219131c Stop disabling MockitoResetTestExecutionListener within a native image
Instead, MockitoResetTestExecutionListener is now only enabled if the
current test class uses Mockito annotations or Mockito-related
annotations in spring-test.

See gh-32933
2024-10-08 17:41:30 +02:00
Sam Brannen 9a4be95dee Verify registration of runtime hints for Bean Overrides
See gh-32933
2024-10-08 17:41:30 +02:00
Sam Brannen 6a2e234a87 Register runtime hints for BeanOverrideProcessors
This commit introduces a BeanOverrideReflectiveProcessor which
registers runtime hints for any BeanOverrideProcessor configured
via @⁠BeanOverride.

See gh-32933
2024-10-08 17:41:17 +02:00
Sam Brannen 5ddeb06640 Skip pseudo bean definition registration during AOT processing
Prior to this commit, AOT processing failed for tests that made use of
the Bean Override feature to "override" a nonexistent bean. The reason
is that we register a "pseudo" bean definition as a placeholder for a
nonexistent bean, and our AOT support cannot automatically convert that
"pseudo" bean definition to a functional bean definition for use at AOT
runtime.

To address that, this commit skips registration of "pseudo" bean
definitions during AOT processing, and by doing so we enable the JVM
runtime and AOT runtime to operate with the same semantics.

See gh-32933
2024-10-08 17:41:11 +02:00
Sam Brannen ce8e06cf10 Register Bean Override infrastructure beans as manual singletons
Prior to this commit, AOT processing failed for tests that made use of
the Bean Override feature, since the Set<OverrideMetadata> constructor
argument configured in the bean definition for the
BeanOverrideBeanFactoryPostProcessor cannot be properly processed by
our AOT support. The reason is that each OverrideMetadata instance is
effectively an arbitrary object graph that cannot be automatically
converted to a functional bean definition for use at AOT runtime.

To address that, this commit registers Bean Override infrastructure
beans as manual singletons instead of via bean definitions with the
infrastructure role.

See gh-32933
2024-10-08 16:58:59 +02:00
Juergen Hoeller f590511112 Introspect pre-registered singletons in preDetermineBeanTypes as well
Closes gh-33668
2024-10-08 16:50:12 +02:00
rstoyanchev c4b6a02091 Polishing contribution
Closes gh-33594
2024-10-08 13:32:33 +01:00
Johnny Lim 1ec9a115a8 Replace RFC 7807 with RFC 9457 in documentation
See gh-33594
2024-10-08 13:32:33 +01:00
Brian Clozel 3303c98650 Fix link to code of conduct
Closes gh-33663
2024-10-08 14:03:54 +02:00
rstoyanchev 000b8a699c Auto-detect Reactor Netty client in RestClient
Closes gh-33635
2024-10-08 10:56:43 +01:00
rstoyanchev a84a41fa43 Polishing contribution
Closes gh-33638
2024-10-08 10:56:42 +01:00
Dariusz Jędrzejczyk a78385f8e5 Handle X-Forwarded-Prefix parsed by Reactor Netty
See gh-33638
2024-10-08 10:56:42 +01:00
Juergen Hoeller f9f025df43 Add note on autowireCandidate versus defaultCandidate
Closes gh-33392
2024-10-08 11:36:39 +02:00
Juergen Hoeller 1eee795143 Merge branch '6.1.x' 2024-10-08 11:34:27 +02:00
Juergen Hoeller 2622db1dbe Consistent references to annotation-based autowiring 2024-10-08 11:26:42 +02:00
rstoyanchev b13f86cf46 Fix failing tests in spring-test after recent changes
See gh-33639
2024-10-07 21:09:10 +01:00
rstoyanchev 2389748e25 Parameterize URI parsing tests
Closes gh-33639
2024-10-07 18:35:03 +01:00
rstoyanchev d6fcad9ad7 Add logging to RfcUriParser
See gh-33639
2024-10-07 18:35:03 +01:00
rstoyanchev ef0a21ec7a Update documentation for URI parsing types
See gh-33639
2024-10-07 18:35:03 +01:00
rstoyanchev 6c62965cbb Remove regular expressions from UriComponentsBuilder
See gh-33639
2024-10-07 18:35:03 +01:00
rstoyanchev bbb53d03c4 Pluggable URI parsing, use RFC parser by default
See gh-33639
2024-10-07 18:35:03 +01:00