Commit Graph

1607 Commits

Author SHA1 Message Date
Sébastien Deleuze c091bbdeaa Merge branch '5.3.x' 2022-11-02 12:18:15 +01:00
Sébastien Deleuze c14cbd07f4 Use non-null DateFormat for CustomDateEditor in tests
Closes gh-29419
2022-11-02 12:01:49 +01:00
Sébastien Deleuze 403cfefc28 Add AOT processing of bean aliases
This commit adds AOT processing of bean aliases.

Closes gh-29391
2022-11-02 10:07:21 +01:00
Juergen Hoeller 6b6cf1b4a2 Avoid decorated definition bypass for scoped proxy determination
GenericApplicationContext registers proxy hints without any SmartInstantiationAwareBeanPostProcessor involved as well.

Closes gh-29335
2022-10-19 09:55:47 +02:00
Juergen Hoeller cb44e09694 Merge branch '5.3.x' 2022-10-18 16:24:35 +02:00
Juergen Hoeller 4b0bf16389 Select ambiguous write method based on read method (matching its return type)
Also avoids unnecessary checks in name-based PropertyDescriptor constructor.

See gh-29320
2022-10-18 16:17:03 +02:00
Stephane Nicoll 6d688e196d Restore support of list of inner bean definitions
This commit restores the support of multiple bean definitions being
specified in a `List` as a property value or constructor argument.

Rather than handling inner bean definitions externally, there are now
supported by BeanDefinitionPropertiesCodeGenerator, and list of such
type is handled transparently.

Closes gh-29075
2022-10-18 15:28:18 +02:00
Johnny Lim 1ea3f49eba Add missing since on setCurrentlyInvokedFactoryMethod()
See gh-29326
2022-10-18 13:03:13 +02:00
Juergen Hoeller e03abc94ff Merge branch '5.3.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
#	spring-beans/src/main/java/org/springframework/beans/PropertyDescriptorUtils.java
#	spring-beans/src/main/java/org/springframework/beans/SimpleBeanInfoFactory.java
#	spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
2022-10-17 12:56:19 +02:00
Juergen Hoeller 33023b240f Provide optional SimpleBeanInfoFactory for better introspection performance
Closes gh-29330
2022-10-17 12:25:53 +02:00
Juergen Hoeller c407dc3df8 Reset/rebuild BeanPostProcessorCache within full synchronization
Closes gh-29299
2022-10-17 12:25:35 +02:00
Juergen Hoeller b796b52d4e Extract SimpleBeanInfo adaptation into internal SimpleBeanInfoFactory
See gh-29320
2022-10-14 12:34:43 +02:00
Juergen Hoeller bba313c2f5 Perform basic property determination without java.beans.Introspector
Closes gh-29320
2022-10-13 19:02:45 +02:00
Stephane Nicoll 061fa475ee Avoid generated code in the javax package
This commit updates the existing logic to also exclude code generation
in the javax package.

Closes gh-29123
2022-10-10 15:09:00 +02:00
Sam Brannen 34e5aac0f5 Reintroduce factory method name in exception thrown from SimpleInstantiationStrategy 2022-10-10 14:28:35 +02:00
Sébastien Deleuze 42c3ac64ff Remove spring.spel.ignore and spring.xml.ignore flags
This commit also removes ResourcePropertiesPersister which
was introduced in 5.3 specifically for spring.xml.ignore
flag and which is expected to be used only internally by
Spring Framework. DefaultPropertiesPersister should be used
instead.

Closes gh-29277
2022-10-10 12:11:19 +02:00
Johnny Lim ced37d53b4 Polishing
Closes gh-29284
2022-10-08 13:43:09 +02:00
Stephane Nicoll c74760540d Polish 2022-10-07 11:42:55 +02:00
Stephane Nicoll a16afe8e10 Describe the replacement use case for BeanRegistrationAotProcessor
Closes gh-29126
2022-10-06 16:42:17 +02:00
Juergen Hoeller 6027be5a39 Ignore overridden factory methods for unique candidate resolution
See gh-27920
2022-10-06 15:06:53 +02:00
Stephane Nicoll 0d5c78d992 Polish 2022-10-06 13:33:58 +02:00
Juergen Hoeller b45a48461f Polishing 2022-10-06 12:03:25 +02:00
Juergen Hoeller aedef9321a Merge AOT constructor and factory method resolution into ConstructorResolver
This moves related code into the same class, unifies candidate determination for constructors and factory methods, and gets rid of the package cycle around the hard-coded Autowired annotation check (which is implicitly coming from AutowiredAnnotationBeanPostProcessor via the determineCandidateConstructors SPI now). The API entry point for AOT pre-resolution purposes is in RegisteredBean.

Closes gh-27920
2022-10-06 11:59:11 +02:00
Stephane Nicoll 2f20d6322b Enable cglib proxy for configuration classes if necessary
This commit updates code generation to customize the instantiation of
a configuration class that requires a proxy. Rather than instantiating
the raw class, the proxy is used.

Closes gh-29107
2022-10-04 16:54:44 +02:00
Stephane Nicoll 9820e3341d Fix handling of protected visibility
Previously, InstanceSupplierCodeGenerator used reflection if the target
visibility is either protected or private, and use direct access if the
target visibility is public or package private.

The previous arrangement already assumed that the code is generateed in
the same package as the target type. This means that protected can be
used as well so this commit only use reflection if the target visibility
is private.

Closes gh-29253
2022-10-04 16:49:13 +02:00
Stephane Nicoll 3b2b36d0b8 Allow AccessControl to determine visibility from a given type
This commit adapts AccessVisibility so that it can determine if the
member or type signature is accessible from a given package. This lets
implementers figure out if reflection is necessary without assuming that
package private visibility is OK.

Closes gh-29245
2022-10-03 17:56:19 +02:00
Brian Clozel 054579a892 Temporarily revert gh-29246
This new hint contribution triggers a GraalVM bug and breaks native
compilation for several samples, we need to temporarily revert this
change until a fix is available in GraalVM.

See gh-29246
2022-10-03 14:14:57 +02:00
Brian Clozel ff9792bae0 Polish
See gh-29246
2022-10-03 14:14:01 +02:00
Brian Clozel 332961f833 Contribute introspection hints on registered beans
As a follow up of #29205, we now need to contribute an "introspection on
declared method" reflection hint for all registered beans.

Closes gh-29246
2022-10-03 11:31:24 +02:00
Stephane Nicoll 0b5c3ec267 Polish javadoc 2022-10-03 10:05:27 +02:00
Sam Brannen f6d1806e30 Ensure DefaultListableBeanFactoryTests compiles in Eclipse IDE 2022-09-28 15:44:45 +02:00
Stephane Nicoll 38d91bafce Generate matching structure for configuration classes
This commit improves GeneratedClass to support inner classes, allowing
them to be registered by name with a type customizer, as
GeneratedClasses does for top level classes.

BeanDefinitionMethodGenerator leverages this feature to create a
matching structure for configuration classes that contain inner classes.

Closes gh-29213
2022-09-28 11:13:52 +02:00
Stephane Nicoll e6aef11b09 Allow target to be a ClassName rather than an existing Class
See gh-29207
2022-09-27 10:33:14 +02:00
Stephane Nicoll 8ef850ff91 Update ClassNameGenerator to work with a ClassName target
This commit updates ClassNameGenerator so that it uses a ClassName for
its default target. This makes sure that a target that has been
generated can be used.

See gh-29027
2022-09-27 10:33:13 +02:00
Adam Ostrožlík 0ccb64fe10 Replace Collectors.toList with Stream.toList
Closes gh-29203
2022-09-26 18:32:01 +02:00
Sam Brannen a975b9d5da Suppress "unused" warnings in tests 2022-09-26 14:27:32 +02:00
Sébastien Deleuze 9a180d1811 Add JMH benchmarks
Closes gh-24104
2022-09-26 10:23:06 +02:00
Sébastien Deleuze 8e73b57329 Refine Kotlin changes
This refinement ensures the constructor is properly
accessible, avoid duplicating current logic and
provide a slightly faster implementation of the
Kotlin codepath.

See gh-24104
2022-09-26 10:22:46 +02:00
stsypanov edcc559b4a Add fast-path in BeanUtils#instantiateClass
For no-args constructor.

See gh-24104
2022-09-26 10:21:28 +02:00
Stephane Nicoll c19cedede1 Revisit BeanRegistrationCodeFragments
This commit revisit BeanRegistrationCodeFragments to separate the
responsibility between the default implementation and the delegates. It
also reviews how customization are applied by improving the Javadoc and
the method name.

Closes gh-28865
2022-09-22 15:32:28 +02:00
Stephane Nicoll 84fd942712 Add support for Charset for property value code generation
Closes gh-29186
2022-09-21 19:27:05 +02:00
Stephane Nicoll 4625e92eb8 Break dependency between TestCompiler and AOT
This commit improves `TestCompiler` with a `with` function that allows
to customize a test compiler instance. Rather than `TestCompiler`
knowing about `TestGenerationContext`, the latter implements the
function so that it can be passed as is.

See gh-29175
2022-09-20 15:07:51 +02:00
Phillip Webb df9990f66b Relocate MockSpringFactoriesLoader
Closes gh-29176
2022-09-19 22:29:40 -07:00
Phillip Webb 52bffbff76 Move `TestCompiler` and related classes to `core.test.tools` package
Closes gh-29175
2022-09-19 22:29:40 -07:00
Phillip Webb cc7552ec61 Rename @CompileWithTargetClassAccess
Rename `@CompileWithTargetClassAccess` to
`@CompileWithForkedClassLoaderClassLoader`.

Closes gh-29173
2022-09-19 22:29:40 -07:00
Juergen Hoeller 50d34366bc Polishing 2022-09-14 12:55:53 +02:00
Stephane Nicoll 6cfbf391ec Merge branch '5.3.x' 2022-09-13 08:42:56 +02:00
Stephane Nicoll 0d2bfc926f Apply consistent ordering in hierarchical contexts
Previously, if `@Order` is specified on a `@Bean` method, and the
candidate bean is defined in a parent context, its order wasn't taken
into account when retrieving the bean from a child context.

This commit makes sure the metadata of a bean is taken into
consideration in all cases.

Closes gh-29105
2022-09-13 07:23:22 +02:00
Stephane Nicoll 58a2b79699 Harmonize hint registration
Previously, a shortcut method for the default ExecutableMode was
provided, but we found out that the shortcut makes it harder to
determine the intent.

This commit harmonizes hints registration for types, methods, and
fields. An ExecutableMode is now mandatory to register a method or
constructor. Previous methods that infer a mode or provided a
customizer of the builder are deprecated.

Closes gh-29135
2022-09-12 14:51:04 +02:00
Stephane Nicoll 042a4f3518 Polish "Adapt FieldHint to recent GraalVM versions"
See gh-29130
2022-09-12 14:50:28 +02:00