spring-framework/framework-docs/modules/ROOT/pages/testing/testcontext-framework
Sam Brannen d79258ac73 Reject non-singletons in Test Bean Override support
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
2024-09-29 18:12:00 +02:00
..
ctx-management Polish DynamicPropertyRegistrar documentation 2024-09-12 13:20:59 +02:00
aot.adoc Polishing 2023-11-28 16:21:58 +01:00
application-events.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
bean-overriding.adoc Reject non-singletons in Test Bean Override support 2024-09-29 18:12:00 +02:00
bootstrapping.adoc Split files 2023-05-04 15:35:05 +01:00
ctx-management.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
executing-sql.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
fixture-di.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
key-abstractions.adoc Extract recurring asciidoc links to attributes, cleanup old doc files 2023-11-21 15:59:24 +01:00
parallel-test-execution.adoc Document parallel execution regarding @⁠MockitoBean & @⁠MockitoSpyBean 2024-07-01 17:08:09 +02:00
support-classes.adoc Document that TestContextAnnotationUtils is required for @⁠Nested support 2024-09-24 11:55:44 +02:00
tel-config.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
test-execution-events.adoc Stop referring to old Spring versions in the reference manual 2024-07-01 18:37:46 +02:00
tx.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
web-scoped-beans.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00