Commit Graph

31788 Commits

Author SHA1 Message Date
Juergen Hoeller
e5be10d53d Consistently throw IOException from ReactorNettyClientResponse
Aligned with ReactorNettyClientRequest.

See gh-32952
2024-06-04 23:43:10 +02:00
Juergen Hoeller
017bf4534d Merge branch '6.1.x' 2024-06-04 23:00:46 +02:00
Juergen Hoeller
524da905db Consistently throw IOException from ReactorNettyClientRequest
This commit renames ReactorNettyClientRequestFactoryTests.

Closes gh-32952
2024-06-04 22:59:29 +02:00
Juergen Hoeller
4323c60513 Common context lifecycle management for ReactorResourceFactory
This commit moves ReactorResourceFactoryTests to same package.

Closes gh-32945
2024-06-04 22:59:18 +02:00
Juergen Hoeller
28eb9aebcf Add BeanFactoryInitializer callback before preInstantiateSingletons
Closes gh-32836
2024-06-04 22:50:42 +02:00
Juergen Hoeller
f10caf6aa6 Compare text with system line separator (for Windows compatibility)
See gh-32756
2024-06-04 22:50:14 +02:00
Sam Brannen
cf3171dae0 Find unique @⁠TestBean factory methods in class hierarchy
I accidentally introduced a regression in commit d185bb1d97 by no
longer checking the number of unique method names found when searching
for @⁠TestBean factory methods.

This commit reintroduces that check and introduces a proper unit test
in TestBeanOverrideProcessorTests.

It turns out that we already had an integration test that was intended
to check for this scenario; however, that test actually did not test
this scenario due to a copy-and-paste error. Thus, this commit also
updates TestBeanInheritanceIntegrationTests so that
fieldInSupertypeWithPrioritizedFactoryMethodInSubtype() tests what it's
supposed to.
2024-06-04 18:47:32 +02:00
Sam Brannen
069c6788f5 Polishing 2024-06-04 18:47:32 +02:00
Stéphane Nicoll
aa4b226a22 Add support for converting json values using AssertFactory
This commit benefits from a feature introduced in AssertJ 3.26.0, see
https://github.com/assertj/assertj/pull/3377.

This allows to use any AssertFactory and convert the actual value to
the type the factory manages. Previously, we were using
ParameterizedTypeReference to express the type with its generic
signature but the returned assert object would not be narrowed to the
converted type.

Thanks to this change, we can request to convert the actual value to
`InstanceOfAssertFactories.list(Member.class)` and get a `ListAssert`
of `Member` as a result, rather than an `ObjectAssert` of `List<User>`.

Thanks very much to @scordio for his efforts.

Closes gh-32953
2024-06-04 17:11:08 +02:00
Sébastien Deleuze
6212831f5f Merge branch '6.1.x' 2024-06-04 16:47:36 +02:00
Sébastien Deleuze
f6b608eecb Consistently support Hibernate annotation hint inference on methods
See gh-32842
2024-06-04 16:46:25 +02:00
Sébastien Deleuze
4da1511ed3 Infer hints for Hibernate generators
This commit updates
PersistenceManagedTypesBeanRegistrationAotProcessor
in order to infer hints for Hibernate annotations meta
annotated with `@ValueGenerationType` (like `@CreationTimestamp`)
and `@IdGeneratorType`.

`@GenericGenerator` is not supported as it is deprecated as of
Hibernate 6.5.

Closes gh-32842
2024-06-04 16:46:25 +02:00
Stéphane Nicoll
5cd4b87bfa Merge branch '6.1.x' 2024-06-04 15:52:26 +02:00
Stéphane Nicoll
7102c33661 Add section about using complex data structures with AOT
Closes gh-32273
2024-06-04 15:51:40 +02:00
Sam Brannen
4d961fa472 Find @⁠TestBean factory methods in multi-level @⁠Nested hierarchy
Prior to this commit, a @⁠TestBean factory method was found in the
directly enclosing class for a @⁠Nested test class; however, such a
factory method was not found in the enclosing class of the enclosing
class, etc.

This commit updates the search algorithm for @⁠TestBean factory methods
so that it recursively searches the enclosing class hierarchy for
@⁠Nested test classes.

Closes gh-32951
2024-06-04 15:36:40 +02:00
Sam Brannen
f68130d2e5 Update Javadoc for @⁠TestBean support
See gh-32943
2024-06-04 15:12:06 +02:00
Stéphane Nicoll
42ace2c2c9 Provide dedicated AOT exception hierarchy
This commit adds a number of catch point that provides additional
context when an AOT processor fails to execute. Amongst other things,
this makes sure that the bean name and its descriptor is consistently
provided in the error message when available.

Closes gh-32777
2024-06-04 09:36:21 +02:00
Sébastien Deleuze
f31113e325 Merge branch '6.1.x' 2024-06-03 18:58:33 +02:00
Sébastien Deleuze
43409b00d0 Refine KotlinDetector.isKotlinType documentation
This commit documents changes in lambda detection
as of Kotlin 2.0.

Closes gh-32905
2024-06-03 18:58:13 +02:00
Sébastien Deleuze
eefdf42e7e Merge branch '6.1.x' 2024-06-03 18:28:17 +02:00
Sébastien Deleuze
d55abc6cf9 Fix RegisterReflectionForBinding Javadoc
Closes gh-32947
2024-06-03 18:26:24 +02:00
Sébastien Deleuze
31806f3a6b Fix MethodValidationPostProcessor refdoc
Closes gh-32929
2024-06-03 18:20:52 +02:00
Sam Brannen
acdd8a0015 Improve exception handling in bean override support
- Do not silently abort bean override processing if the ApplicationContext
  is not a BeanDefinitionRegistry.

- Include conflicting bean names in error messages instead of just the
  number of conflicting beans.

- Consistently throw IllegalStateException.

- etc.
2024-06-03 16:57:19 +02:00
Sam Brannen
7a11899c0c Stop using deprecated ThemeChangeInterceptor in WebConfiguration example 2024-06-03 16:14:07 +02:00
Sam Brannen
d185bb1d97 Support @⁠TestBean factory methods defined in interfaces
Prior to this commit, @⁠TestBean factory methods were required to be
defined in the test class or one of its superclasses. However, users
may wish to define common factory methods in interfaces that can be
shared easily across multiple test classes simply by implementing the
necessary interface(s).

This commit therefore switches from ReflectionUtils to
MethodIntrospector to find @⁠TestBean factory methods in implemented
interfaces within the type hierarchy of the test class.

Closes gh-32943
2024-06-03 16:04:46 +02:00
Stéphane Nicoll
6a761412a8 Simplify BeanRegistrationsAotProcessor
Closes gh-32944
2024-06-03 16:01:12 +02:00
Juergen Hoeller
34eccbe8e6 Remove final declaration from getMessageSource() and getLocale() methods
Includes checking the Servlet 3.0+ ServletRequest.getServletContext() method in the request-only constructors, being able to fall back to the root WebApplicationContext.

See gh-32926
2024-06-03 15:27:33 +02:00
Andre Blanke
a582e48dd0 Use getMessageSource internally in RequestContext 2024-06-03 15:22:44 +02:00
Sam Brannen
9ceaf21d24 Extract findMethods() logic in TestBeanOverrideProcessor 2024-06-03 14:56:43 +02:00
Sam Brannen
1536f34fff Fix broken tests 2024-06-03 14:40:13 +02:00
Sam Brannen
8047a22237 Polish TestBeanOverrideProcessor 2024-06-03 13:29:50 +02:00
Juergen Hoeller
f7e7d1b7b0 Merge branch '6.1.x' 2024-06-03 12:47:17 +02:00
Juergen Hoeller
8a84241c1e Polishing 2024-06-03 12:46:31 +02:00
Juergen Hoeller
624be6d4e6 Report bean creation failure in sortAdvisors as AopConfigException
Closes gh-32230
2024-06-03 12:46:14 +02:00
Juergen Hoeller
b08883b65c Avoid NoSuchMethodException for annotation attribute checks
Closes gh-32921
2024-06-03 12:45:11 +02:00
Sam Brannen
df238d08eb Polishing 2024-05-31 18:01:49 +02:00
Sam Brannen
742c41a568 Polishing 2024-05-31 16:18:31 +02:00
Sam Brannen
3a448701f7 Improve class names 2024-05-31 15:49:26 +02:00
Sam Brannen
967800a2f9 Merge branch '6.1.x' 2024-05-31 12:23:22 +02:00
Cong-Xin Cynthia Qiu
542ba3517f Fix typo in Jakarta validation documentation
Closes gh-32928
2024-05-31 12:22:02 +02:00
Sam Brannen
87c93d35d6 Revise bean override tests with a focus on AOT support
As a follow up to the previous commit (31f8e12adb), this commit
polishes bean override tests and revises them with a focus on AOT
testing support and simplified maintenance.

- Introduce EngineTestKitUtils to simplify working with JUnit's
  EngineTestKit.

- Use idiomatic EngineTestKit APIs to simplify assertions on
  EngineTestKit results.

- Introduce BeanOverrideTestSuite to simplify running all bean override
  tests within the IDE.

- Separate failure and success scenario tests, so that failure tests do
  not launch the JUnit Platform to run tests using the Spring
  TestContext Framework (TCF) within a test class that itself uses the
  TCF.

- Make AbstractTestBeanIntegrationTestCase actually abstract.

- Rename test case classes to give them meaningful names and simplify
  understanding of what's being tested.

- Ensure tests for @⁠MockitoSpyBean functionality use @⁠MockitoSpyBean
  instead of @⁠MockitoBean.

- Declare @⁠Configuration classes local to @⁠SpringJUnitConfig test
  classes whenever possible.

See gh-29122
See gh-32925
2024-05-31 12:19:31 +02:00
Sam Brannen
31f8e12adb Separate failure and success scenario tests for @⁠TestBean
This commit also ensures that @⁠Bean methods are declared within
@⁠Configuration classes instead of within test classes.

See gh-29122
2024-05-29 14:21:58 +02:00
Sam Brannen
1f537b97d5 Demonstrate how to disable Bean Override tests in AOT mode
See gh-29122
2024-05-29 14:20:35 +02:00
Sam Brannen
cade3c7b0e Ensure MockMvcTesterIntegrationTests runs in AOT mode
See gh-29122
2024-05-29 13:32:22 +02:00
Sam Brannen
a0c9a204b8 Polishing 2024-05-29 13:32:02 +02:00
Juergen Hoeller
8f21137883 Merge branch '6.1.x' 2024-05-28 18:47:38 +02:00
Juergen Hoeller
8c6a7799be Upgrade to Checkstyle 10.17 2024-05-28 18:46:22 +02:00
Juergen Hoeller
557dbba585 Remove superfluous addToClassHierarchy call for Enum types
Closes gh-32906
2024-05-28 18:45:05 +02:00
Juergen Hoeller
5a275443b5 Apply ThreadLocal#remove() to pre-instantiation threads
See gh-13410
See gh-32874
2024-05-28 16:35:58 +02:00
Sam Brannen
27985b1439 Disable class data sharing (CDS) for tests
Prior to this commit, the Gradle build output the following warning
multiple times.

OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

Since we don't need CDS enabled for our tests, I've added `-Xshare:off`
as a JVM argument for our tests to disable CDS.
2024-05-28 15:58:02 +02:00