Commit Graph

24803 Commits

Author SHA1 Message Date
Brian Clozel
fea29ea4cd Upgrade Gradle plugins 2022-08-04 11:29:34 +02:00
Brian Clozel
9e71889ed9 Merge branch '5.3.x' 2022-08-04 11:02:52 +02:00
Chanhyeong Cho
8685b2f5bf Fix broken kdoc-api links in kotlin.adoc
Fixes gh-28908
2022-08-04 11:02:02 +02:00
Sam Brannen
843221b448 Fix broken Javadoc links
See gh-28906
2022-08-04 11:51:56 +03:00
Stephane Nicoll
6c81ac9454 Merge branch '5.3.x' 2022-08-04 10:04:00 +02:00
Stephane Nicoll
4af225405c Upgrade Java 18 version in CI image 2022-08-04 10:02:49 +02:00
Stephane Nicoll
51e594ae81 Upgrade Java 17 version in CI image 2022-08-04 10:02:15 +02:00
Stephane Nicoll
c2554b2b27 Upgrade Java 11 version in CI image 2022-08-04 10:01:49 +02:00
Stephane Nicoll
86a762b5ee Upgrade Java 8 version in CI image 2022-08-04 10:01:23 +02:00
Stephane Nicoll
211241befe Upgrade Ubuntu version in CI image 2022-08-04 10:00:30 +02:00
Stephane Nicoll
e50db8c8c5 Make sure that ImportAwareAotBeanPostProcessor has role infrastructure
See gh-28915
2022-08-04 09:37:17 +02:00
Stephane Nicoll
332d4a4c9c Apply same order than original BPP
This commit updates ImportAwareAotBeanPostProcessor to be priority
ordered, with the same order as its original BeanPostProcessor. This
makes sure that infrastructure beans can be post-processed if
necessary

See gh-28915
2022-08-04 09:35:11 +02:00
Stephane Nicoll
e5f9574800 Fix test
Contribution was not applied on the actual use case

See gh-28915
2022-08-04 09:32:45 +02:00
Brian Clozel
34266f22c7 Merge branch '5.3.x' 2022-08-03 23:16:13 +02:00
Brian Clozel
0caa2ac696 Customize connection in UrlResource getInputStream
Prior to this commit, the `AbstractFileResolvingResource` would
provide a default implementation for `customizeConnection` which only
sets the HTTP request method as "HEAD".
While this is consistent with its usage within that class (in
`exists()`, `contentLength()` or `lastModified()`), this is not opened
for general usage by sub-classes.

`UrlResource` is an example of that, where its `getInputStream()` method
does not call this customization method.

This not only prevents implementations from calling
`customizeConnection` in various cases, but it also misleads developers
as they might think that customizations will be applied automatically.

This commit ensures that `customizeConnection` is called in all relevant
places and that the configuration of the HTTP method is instead done in
each method as it is use case specific.

Fixes gh-28909
2022-08-03 23:13:52 +02:00
Sam Brannen
855a3e5221 Polish ContextLoader support 2022-08-03 18:37:54 +03:00
Sam Brannen
e3f4d810f6 Revise configurable refresh support in SmartContextLoader SPI
This commit revises 903e9f2a02 based on feedback from the Spring Boot
team.

- The original loadContext(MergedContextConfiguration) method is no
  longer deprecated.

- loadContext(MergedContextConfiguration, boolean) has been replaced by
  loadContextForAotProcessing(MergedContextConfiguration) which is
  implemented as a `default` method that throws an
  UnsupportedOperationException.

- Affected code has been refactored to adjust to these changes.

See gh-28906
2022-08-03 16:54:32 +03:00
Stephane Nicoll
3a890033b7 Fix custom bean definition to stop using reflection
See gh-28915
2022-08-03 14:51:52 +02:00
Sam Brannen
903e9f2a02 Introduce configurable refresh support in SmartContextLoader SPI
Prior to this commit, the contract of the loadContext() method in the
SmartContextLoader SPI required that the ApplicationContext be returned
in a fully refreshed state with a JVM shutdown hook registered for it.

However, in order to support AOT processing within the Spring
TestContext Framework (TCF), we need a way to signal to
SmartContextLoader implementations that they should load the test's
ApplicationContext without refreshing it or registering a JVM shutdown
hook.

To address this issue, this commit:

- Introduces a new loadContext(MergedContextConfiguration, boolean)
  method. The boolean `refresh` flag controls whether the returned
  ApplicationContext should be refreshed and have a JVM shutdown hook
  registered for it.

- Deprecates the existing loadContext(MergedContextConfiguration)
  method in favor of loadContext(MergedContextConfiguration, boolean).

- Removes all use of the deprecated method within the spring-test
  module, excluding the exception mentioned below.

Note that loadContext(MergedContextConfiguration, boolean) is
implemented as an interface `default` method which delegates to the
deprecated loadContext(MergedContextConfiguration) method for backward
compatibility. When migrating a SmartContextLoader to Spring Framework
6.0, implementations that directly implement the SmartContextLoader SPI
(instead of extending AbstractGenericContextLoader or
AbstractGenericWebContextLoader) will need to override the new
loadContext(MergedContextConfiguration, boolean) method in order to
honor the `refresh` flag for AOT processing support. See the
implementation in AbstractGenericContextLoader for an example of how
this can be achieved.

Closes gh-28906
2022-08-03 13:10:35 +03:00
Stephane Nicoll
dcad3beeb9 Polish 2022-08-03 11:03:28 +02:00
Stephane Nicoll
c9faff7491 Apply property hints to FactoryBean if necessary
This commit handles a BeanDefinition that configures the FactoryBean
as the "beanClass", while exposing the actual type in "resolvedType".
While unusual, this is required in certain cases when the factory
bean exposes generic information itself.

Previously, the hints for properties injection were applied on the
user type.

Closes gh-28913
2022-08-03 10:58:41 +02:00
Stephane Nicoll
e79a8f6733 Polish 2022-08-03 10:53:57 +02:00
Stephane Nicoll
1fdd91eb30 Restore order of setImportMetadata in AOT optimized contexts
This commit adapts the generated code for handling ImportAware to
register a bean definition rather than adding the BeanPostProcessor
directly on the beanFactory. The previous arrangement put the
post processor handling import aware callbacks first on the list,
leading to inconsistent callback orders.

Tests have been adapted to validate this exact scenario.

Closes gh-28915
2022-08-03 10:16:20 +02:00
Stephane Nicoll
058b5fef6b Merge branch '5.3.x' 2022-08-02 16:11:16 +02:00
Stephane Nicoll
4eb8a5c082 Merge pull request #28914 from izeye
* pr/28914:
  Fix Javadoc since for new modules() and modulesToInstall()

Closes gh-28914
2022-08-02 16:11:04 +02:00
Johnny Lim
d080b64907 Fix Javadoc since for new modules() and modulesToInstall()
See gh-28914
2022-08-02 16:10:47 +02:00
Sam Brannen
abd06768a3 Avoid dependence on deprecated ContextLoader API within AbstractContextLoader
See gh-28905
2022-08-02 15:29:04 +03:00
Sam Brannen
cf1d4638ae Avoid use of deprecated ContextLoader methods in tests
See gh-28905
2022-08-02 15:12:40 +03:00
Sam Brannen
72548f7611 Improve documentation of SmartContextLoader contracts 2022-08-02 13:48:53 +03:00
Sam Brannen
ee33aa6117 Remove remaining reference to GenericPropertiesContextLoader
See gh-28911
2022-08-02 13:12:28 +03:00
Sam Brannen
2207d65b82 Deprecate methods in ContextLoader API in the TestContext framework
For Spring Framework 6.0 we have decided to deprecate the obsolete
methods in the ContextLoader API in the Spring TestContext Framework in
favor of the methods in the SmartContextLoader API which has been
available since Spring Framework 3.1.

Closes gh-28905
2022-08-02 13:07:12 +03:00
Sam Brannen
9c91375d75 Remove deprecated GenericPropertiesContextLoader from the TCF
Since GenericPropertiesContextLoader was deprecated in Spring Framework
5.3, we have decided to remove it in Spring Framework 6.0.

Closes gh-28911
2022-08-02 13:07:12 +03:00
Sam Brannen
b0ab0edd9d Polishing 2022-08-02 13:07:12 +03:00
Brian Clozel
42b3339cb9 Fix RecordedInvocation instance resolution
This commit fixes `RecordedInvocation` and
`RuntimeHintsInvocationsAssert` so that they don't refer to the recorded
instance for static calls.

This also consistently resolves the `TypeReference` of recorded
instances.

Fixes gh-28907
2022-08-01 17:45:55 +02:00
Sam Brannen
e4a7e35ead Polish TestCompiler 2022-08-01 13:41:50 +03:00
Sam Brannen
42ea09b08a Remove Hamcrest support from CompileWithTargetClassAccessClassLoader
CompileWithTargetClassAccessClassLoader is currently only used within the
CompileWithTargetClassAccessExtension which is dedicated to JUnit Jupiter
support which in turn should not have any direct dependencies on Hamcrest.

In other words, the JupiterTestEngine should not load any Hamcrest types
that would cause issues with the CompileWithTargetClassAccessClassLoader.
2022-08-01 13:37:03 +03:00
Sam Brannen
d9bf3e54f7 Removed unused method parameter
See gh-28901
2022-08-01 13:29:48 +03:00
Phillip Webb
4a23d9234c Include shadow source jars in eclipse setup
See gh-28892
2022-08-01 11:28:01 +01:00
Sam Brannen
ce850a583c Support overloaded test methods in CompileWithTargetClassAccessExtension
Prior to this commit, CompileWithTargetClassAccessExtension failed to
properly select overloaded test methods because it ignored the method
parameter list when looking up the test method.

This commit addresses this issue by selecting the test method using its
fully qualified method name which takes in account the class name,
method name, and parameter names.

Closes gh-28901
2022-08-01 13:07:58 +03:00
Sam Brannen
8fb27c3857 Polish CompileWithTargetClassAccessExtension 2022-08-01 13:07:58 +03:00
Sam Brannen
4896b115d2 Ensure CompileWithTargetClassAccessExtension only uses Jupiter TestEngine
Commit 9dd7f5412a (which has now been
reverted) addressed the issue of having the TestNG TestEngine for the
JUnit Platform on the test runtime classpath by allowing `org.testng`
types to pass through to the original ClassLoader; however, that fix
merely obfuscated the underlying issue.

The underlying issue is that the CompileWithTargetClassAccessExtension
is only applicable to JUnit Jupiter tests and therefore should launch
the JUnit Platform with only the JUnit Jupiter TestEngine active.

This commit addresses this issue by applying an EngineFilter to include
only the "junit-jupiter" test engine.

Closes gh-28900
2022-08-01 12:48:41 +03:00
Sam Brannen
b89b6bd7a8 Revert "Support TestNG with @CompileWithTargetClassAccess"
This reverts commit 9dd7f5412a.
2022-08-01 12:44:42 +03:00
Sam Brannen
fa74c353eb Revert "Polishing"
This reverts commit c8648b523b.
2022-08-01 12:44:34 +03:00
Stephane Nicoll
13c68aab52 Merge pull request #28890 from eltociear
* pr/28890:
  Fix typo in BasicJsonWriter.java

Closes gh-28890
2022-08-01 09:17:51 +02:00
Ikko Ashimine
4ac9b7bff2 Fix typo in BasicJsonWriter.java
See gh-28890
2022-08-01 09:17:28 +02:00
Sam Brannen
c8648b523b Polishing 2022-07-31 15:07:02 +03:00
Sam Brannen
9dd7f5412a Support TestNG with @CompileWithTargetClassAccess 2022-07-31 14:57:48 +03:00
Sam Brannen
e4395f2f8b Clean up warnings and polishing 2022-07-31 14:14:56 +03:00
Phillip Webb
9d1e9703ae Include shadowed jar source in published source artifacts
Add a new `ShadowSource` Gradle task and update `spring-core.gradle`
to include source for cglib, javapoet and objenesis.

Closes gh-28892

Co-authored-by: Andy Wilkinson <wilkinsona@vmware.com>
2022-07-30 10:25:58 +01:00
Sam Brannen
2dc8335b7f Make BootstrapUtils public
See gh-28891
2022-07-30 11:21:14 +03:00