Commit Graph

24928 Commits

Author SHA1 Message Date
Sam Brannen 711820ec70 Introduce createContext() factory method in AbstractWebGenericContextLoader
Prior to this commit it was possible to configure the
DefaultListableBeanFactory used by the GenericWebApplicationContext
created by AbstractWebGenericContextLoader, but it was not possible to
completely replace the bean factory.

This commit introduces a new createContext() factory method in
AbstractWebGenericContextLoader which indirectly allows subclasses to
supply a custom DefaultListableBeanFactory implementation to the
GenericWebApplicationContext.

See gh-25600
Closes gh-28983
2022-08-21 15:05:23 +02:00
Sam Brannen 69d87f16ee Reorganize internals of DefaultCacheAwareContextLoaderDelegate 2022-08-21 15:02:28 +02:00
Stephane Nicoll 7637a8d0cf Polish 2022-08-20 10:14:32 +02:00
Juergen Hoeller 427e5f5899 Final merged bean definition clearing in freezeConfiguration
Instead of individual last-minute clearing in markBeanAsCreated, the factory clears all merged bean definitions in freezeConfiguration, retaining the changes of merged bean definition post-processing after that point (in particular in refreshForAotProcessing).

Closes gh-28948
2022-08-19 17:30:59 +02:00
Sam Brannen 7c91776d3d Clean up warnings in tests 2022-08-19 16:11:09 +02:00
Sam Brannen 409ee9234d Merge branch '5.3.x' 2022-08-19 16:06:14 +02:00
Sam Brannen 38f94799f4 Use andExpectAll() in example in MockMvc Javadoc 2022-08-19 16:05:31 +02:00
Sam Brannen 4264d0becd Fix example in MockMvc Javadoc 2022-08-19 16:02:10 +02:00
Stephane Nicoll 4fb4e54c73 Introduce PersistenceManagedTypes and AOT processing of managed entities
This commit adds PersistenceManagedTypes, an abstraction that represents
what typically happens at runtime when a persistence unit is built based
on classpath scanning.

PersistenceManagedTypesScanner extracts the logic that used to be in
DefaultPersistenceUnitManager and the latter can be configured with
a PersistenceManagedTypes instance.

This commits adds a bean registration AOT contribution that retrieves
the result of the configured instance and replaces it with the list
of managed entities. This has the result of making sure scanning, if
any, does not happen at runtime. This also could help if additional
hints for managed entities are required.

Closes gh-28287
2022-08-19 15:27:44 +02:00
Stephane Nicoll eac616a83e Restore support for package private ReflectiveProcessor
See gh-28975
2022-08-18 14:27:59 +02:00
Stephane Nicoll d6afa8df2d Improve registration of the same hint for multiple classes
Based on the feedback in #28977 an easy way to create a list of
type references based on a vararg of classes is helpful when
registering the same hints for several types.
2022-08-18 06:52:34 +02:00
Stephane Nicoll 4556895e6e Expose registrar for @Reflective
This commit exposes the logic of processing `@Reflective` on beans so
that it can be reused in custom arrangements.

Closes gh-28975
2022-08-17 14:33:09 +02:00
Sam Brannen ef7ab768e7 Polishing 2022-08-17 12:03:10 +02:00
Sébastien Deleuze 06d9db154e Introduce CachingBeanRegistrationAotProcessor
It contributes proxy hints for interfaces when class
proxying is not forced.

Closes gh-28943
2022-08-17 11:38:12 +02:00
Sébastien Deleuze 491b7771d0 Register proper caching annotation runtime hints
See gh-28943
2022-08-17 11:36:24 +02:00
Sam Brannen 8fe6a9f537 Handle NoClassDefFoundError consistently for skipped TestExecutionListener
Commit d1b65f6d3e introduced a regression for the handling of
NoClassDefFoundError when skipping a TestExecutionListener that cannot
be loaded. Specifically, the DEBUG log message changed and included the
stack trace; whereas, it previously did not include the stack trace.

This commit consistently handles NoClassDefFoundError for a skipped
TestExecutionListener, whether a default listener or a listener
registered via @TestExecutionListeners and aligns with the previous
behavior by omitting the stack trace for a NoClassDefFoundError.

Closes gh-28962
2022-08-17 11:25:51 +02:00
Sam Brannen 7e8d6dbd45 Remove obsolete HintType.CLASS_PROXIES enum constant
See gh-28972
2022-08-17 11:16:45 +02:00
Stephane Nicoll 9846d28ae6 Remove support for declaring class proxies hints
Closes gh-28972
2022-08-17 09:25:03 +02:00
Stephane Nicoll f4389c3114 Restore ANNOTATION_HINT in a deprecated form for the time being 2022-08-16 16:18:04 +02:00
Stephane Nicoll b03d0479e4 Merge branch 'gh-28967'
Closes gh-28967
2022-08-16 15:52:04 +02:00
Stephane Nicoll 494bca727f Disable RuntimeHints tests with the agent
Tests with the agent are broken now that hints for an annotation is
no longer required if the annotated element has an introspection hint.

See gh-28967
2022-08-16 15:42:52 +02:00
Stephane Nicoll 4f0c879778 Rationalize hints required for annotations
This commit updates RuntimeHintsUtils to focus on registering a JDK
proxy only as annotations of annotated elements that have at least
an introspection hints are visible out-of-the-box.

This commit also removes unnecessary hints and adapt `@Reflective` to
detect if a hint is required using the introduced
MergedAnnotation#isSynthesizable.

See gh-28967
2022-08-16 15:42:52 +02:00
Stephane Nicoll 32346b8382 Introduce isSynthesizable in MergedAnnotation
This commit adds the ability to check if a the annotation managed by
a MergedAnnotation is synthesizable. This makes it easier to register
a JDK proxy hint if necessary

See gh-28967
2022-08-16 15:42:52 +02:00
Sam Brannen 653552aa6f Make DefaultGenerationContext(GeneratedClasses,...) package private
The DefaultGenerationContext constructor which accepts an instance of
GeneratedClasses is now package private since GeneratedClasses can only
be created within the `org.springframework.aot.generate` package.
2022-08-16 12:06:40 +02:00
Sam Brannen 36fa8bd26b Remove unused constructors in TestGenerationContext 2022-08-16 12:06:40 +02:00
Arjen Poutsma 59c2f4c069 Allow null for ResponseEntity.HeadersBuilder::eTag
Closes gh-28947
2022-08-16 12:02:00 +02:00
Arjen Poutsma ef178d24ec Merge branch '5.3.x' 2022-08-16 11:24:01 +02:00
Arjen Poutsma 7e7d6b9c3a Propagate Context in DataBufferUtils::write(Path)
This commit makes sure that the Reactor context is propagated in
DataBufferUtils::write(Path).

Closes gh-28933
See gh-27517
2022-08-16 11:21:12 +02:00
Arjen Poutsma cb8163b8c7 Updated Java 17 version in sdkmanrc 2022-08-16 11:00:20 +02:00
Stephane Nicoll 9a1b7c5e47 Allow target type of a cglib proxy to be visible
This commit updates the hints of a Cglib proxy's target type so that
methods can be invoked and constructors can be introspected. The former
is needed as a cglib proxy invokes the target type via reflection. As
for that latter, this is required at least by
Enhancer#filterConstructors.

See gh-28954
2022-08-16 08:30:37 +02:00
Sam Brannen c58c827291 Polishing 2022-08-15 19:53:21 +02:00
Sam Brannen 40f9fe0874 Make eclipse task for spring-core depend on JavaPoet and Objenesis tasks 2022-08-13 16:18:34 +02:00
Sam Brannen d6d629a8eb Clean up warnings in CGLIB fork 2022-08-13 16:03:28 +02:00
Stephane Nicoll 6ba31acf35 Polish "Add support for Async invocation in a native image"
This registers the hints if the annotation post processor is active,
rather than statically.

See gh-28710
2022-08-12 17:43:48 +02:00
Stephane Nicoll 0229cc45a0 Add support for Async invocation in a native image
This commit adds necessary hints so that Async-annotated method can be
discovered in a native image.

Closes gh-28710
2022-08-12 16:34:13 +02:00
Stephane Nicoll 3086d90e7d Add the necessary hints for use of Cglib proxies
This commit expands GeneratedClassHandler to allow invocation of
declared fields and methods. Generated proxies have a number of
internal fields and methods that are invoked via reflection.

See gh-28954
2022-08-12 16:27:10 +02:00
Stephane Nicoll 7c2453c373 Integrate class proxy generation in AOT processing
This commit updates ApplicationContextAotGenerator to register a
handler that process Cglib generated classes. The handler registers
such classes to the GeneratedFiles and provide a hint so that it
can be instantiated using reflection.

Closes gh-28954
2022-08-12 12:17:13 +02:00
Juergen Hoeller d6f73994c2 Fix malformed HTML in CGLIB javadoc
See gh-28955
2022-08-12 12:14:18 +02:00
Juergen Hoeller 7fa5b8dcb5 Turn CGLIB patch into full CGLIB fork in spring-core
Closes gh-28955
2022-08-12 11:38:43 +02:00
Sam Brannen a052f9a34e Polishing 2022-08-11 20:43:35 +02:00
Sam Brannen 7631a09405 Do not register SynthesizedAnnotation proxy for @AliasFor
Closes gh-28953
2022-08-11 20:32:03 +02:00
Sam Brannen 0207f3a55f Polishing 2022-08-11 19:41:56 +02:00
Sébastien Deleuze 5c68a278b5 Add SchedulerFactoryBean runtime hints
Also require oracle/graalvm-reachability-metadata#19.

Closes gh-28725
2022-08-11 15:42:53 +02:00
Stephane Nicoll 6ad7b85c27 Merge branch '5.3.x' 2022-08-11 13:31:58 +02:00
Stephane Nicoll dfc06eda7a Upgrade Java 8 version in CI image and .sdkmanrc 2022-08-11 13:31:36 +02:00
Stephane Nicoll d1abdff89c Merge branch '5.3.x' 2022-08-11 10:44:33 +02:00
Stephane Nicoll f0aa6ebed6 Merge pull request #28949 from izeye
* pr/28949:
  Polish "Add missing TreeSet to CollectionFactory.createCollection()"
  Add missing TreeSet to CollectionFactory.createCollection()

Closes gh-28949
2022-08-11 10:43:56 +02:00
Stephane Nicoll 6806aaf162 Polish "Add missing TreeSet to CollectionFactory.createCollection()"
See gh-28949
2022-08-11 08:28:43 +02:00
Johnny Lim ccec75c98d Add missing TreeSet to CollectionFactory.createCollection()
See gh-28949
2022-08-11 08:22:11 +02:00
Juergen Hoeller 293e296d59 Reflectively invoke getIdentifier method (for compatibility with Hibernate 6)
Closes gh-28855
2022-08-11 00:55:33 +02:00