Description
In the course of addressing #29823, it turns out that AutowireCapableBeanFactory.createBean(Class)
could apply AUTOWIRE_CONSTRUCTOR
by default, kicking in when no AutowiredAnnotationBeanPostProcessor
or the like specifically determines constructors to consider. This extends the semantics of the createBean(Class)
method itself to flexibly select a constructor rather than potentially insist on a no-arg constructor.
Note that with AutowiredAnnotationBeanPostProcessor
present, even a non-annotated constructor with arguments would be selected if no default constructor is declared (due to AABPP's general algorithm). This effectively contradicts the AbstractAutowireCapableBeanFactory
default behavior, it was just not noticeable since AutowiredAnnotationBeanPostProcessor
used to be present in all common application context setups.
With this aligned, all existing calls of createBean(beanClass, AUTOWIRE_CONSTRUCTOR, false)
in various Spring integration points can be replaced with createBean(Class)
then. This also serves as a preparation for deprecating the autowireMode-based AutowireCapableBeanFactory
methods eventually.