Prior to this commit, a non-singleton FactoryBean was silently replaced by a singleton bean. In addition, bean definitions for prototype-scoped and custom-scoped beans were replaced by singleton bean definitions that were incapable of creating the desired bean instance. For example, if the bean type of the original bean definition was a concrete class, an attempt was made to invoke the default constructor which either succeeded with undesirable results or failed with an exception if the bean type did not have a default constructor. If the bean type of the original bean definition was an interface or a FactoryBean that claimed to create a bean of a certain interface type, an attempt was made to instantiate the interface which always failed with a BeanCreationException. To address the aforementioned issues, this commit reworks the logic in BeanOverrideBeanFactoryPostProcessor so that an exception is thrown whenever an attempt is made to override a non-singleton bean. Closes gh-33602 |
||
|---|---|---|
| .. | ||
| ctx-management | ||
| aot.adoc | ||
| application-events.adoc | ||
| bean-overriding.adoc | ||
| bootstrapping.adoc | ||
| ctx-management.adoc | ||
| executing-sql.adoc | ||
| fixture-di.adoc | ||
| key-abstractions.adoc | ||
| parallel-test-execution.adoc | ||
| support-classes.adoc | ||
| tel-config.adoc | ||
| test-execution-events.adoc | ||
| tx.adoc | ||
| web-scoped-beans.adoc | ||