Explicit BeanDefinition#targetType is not honoured in AOT scenarios #30689
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
theme: aot
An issue related to Ahead-of-time processing
type: bug
A general bug
Milestone
Courtesy of @wilkinsona https://github.com/snicoll-scratches/lost-target-type
To reproduce:
The use case is registering a bean definition on the fly with the factory method of another bean definition, but perhaps this can be generalized.
The bean definition looks like this:
Its instance supplier refers to a method that's going to produce a bean of type
One
.One
andTwo
are unrelated and the factory method produces an instance that implements them both.It looks like the bean definition's bean class is ignored in favor of the bean factory method. The following works:
We should review this use case and see whether AOT has to generate a more precise definition or if the context should fallback first on the bean class.
The text was updated successfully, but these errors were encountered: