This commit harmonizes the registration of an executable so that
the default method and the method that takes an empty customizer
produces the same hint. The same applies to the readable flag of
a field hint.
Rather than returning a list of executable modes, the "highest" mode
is retained.
See gh-29011
This commit makes use of the new `getLazyResolutionProxyClass` on
`AutowireCandidateResolver` to detect if a injection point requires
a proxy.
Closes gh-28980
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
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
Includes runtime storing of generated classes to a directory specified by the "cglib.generatedClasses" system property. Avoids lazy CGLIB fast-class generation and replaces generated Enhancer and MethodWrapper key classes with equivalent record types. Introduces support for early type determination in InstantiationStrategy, AopProxy and SmartInstantiationAwareBeanPostProcessor - in order to trigger CGLIB class generation in refreshForAotProcessing (through early determineBeanType calls for bean definitions).
Closes gh-28115
This commit updates InitDestroyAnnotationBeanPostProcessor to mutate
the original bean definition rather than the merged one that can be
recreated without it if the cache gets stale.
See gh-28215
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
Update `BeanDefinitionMethodGeneratorFactory` to enforce that any
`BeanRegistrationExcludeFilter` filter that is from a bean factory
also implements an AOT processor interface.
See gh-28866
Add an `AotServices` class to replace `AotFactoriesLoader`. The
replacement class allow instances to be loaded from just the
`aot.factories` file if required. It also retains a link to the bean
names so that a `findByBeanName(...)` method can be provided.
See gh-28833
This commit allows a RootBeanDefinition to resolve its infer destroy
method if necessary. Contrary to BeanInstanceAdapter that uses the
actual bean instance, the new method works against the type exposed
in the bean definition.
The AOT contribution of InitDestroyAnnotationBeanPostProcessor uses
the new method to make sure the special '(inferred)' placeholder is
handled prior to code generation.
Closes gh-28215
This commit polishes DefaultGenerationContext to make the method
that flushes generated classes more explicit. It now throws an
IOException and TestGenerationContext has been updated to handle
that to ease its use in code that can't throw such an exception.
As this use case is likely to happen outside the Spring Framework,
this commit adds such a convenience to spring-test as well.
Closes gh-28877
This commit polishes 85d4a79 so that the target type of factory bean
is only considered if the FactoryBean is accessible. If the FactoryBean
requires protected access, we still generate the code in the package of
the FactoryBean.
Those two commits combined are actually providing a fix for the use
case described in gh-28809.
Closes gh-28809
This commit improves the location of generated bean definitions for
FactoryBean implementations by checking the type that the factory
bean generates, rather than the factory bean implementation itself.
Closes gh-28812
Migrate all AOT tests to make use of `GeneratedClasses` rather than
directly generating Java files. This commit also refines and polishes
AOT APIs to being greater consistency.
Specifically:
- The `MethodGenerator` interface has been removed in favor of
working directly with `GeneratedMethods`.
- The visibility of several constructors and methods has been
reduced to package-private.
- The `using(...)` and `builder` methods have been removed in
favor of setting the `Consumer` callbacks directly as
constructor arguments.
- Variable names for builders are now named `type` or `method`
depending on what they're building.
Closes gh-28831