spring-framework/framework-docs/modules/ROOT/pages/testing/testcontext-framework
Sam Brannen 30db2e4fb5
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Support Bean Overrides for non-singletons
Prior to this commit, the BeanOverrideBeanFactoryPostProcessor rejected
any attempt to override a non-singleton bean; however, due to interest
from the community, we have decided to provide support for overriding
non-singleton beans via the Bean Override mechanism — for example, when
using @⁠MockitoBean, @⁠MockitoSpyBean, and @⁠TestBean.

With this commit, we now support Bean Overrides for non-singletons: for
standard JVM runtimes as well as AOT processing and AOT runtimes. This
commit also documents that non-singletons will effectively be converted
to singletons when overridden and logs a warning similar to the
following.

WARN: BeanOverrideBeanFactoryPostProcessor - Converting 'prototype' scoped bean definition 'myBean' to a singleton.

See gh-33602
See gh-32933
See gh-33800
Closes gh-35574
2025-10-07 15:33:18 +02:00
..
ctx-management Revise reference docs regarding new ApplicationContext pause() support 2025-08-04 12:05:26 +03:00
aot.adoc Polishing 2023-11-28 16:21:58 +01:00
application-events.adoc Improve documentation for ApplicationEvents to clarify recommended usage 2025-08-20 16:42:22 +02:00
bean-overriding.adoc Support Bean Overrides for non-singletons 2025-10-07 15:33:18 +02:00
bootstrapping.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
ctx-management.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
executing-sql.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
fixture-di.adoc Merge branch '6.2.x' 2025-07-10 19:42:14 +02:00
key-abstractions.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
parallel-test-execution.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
support-classes.adoc Merge branch '6.2.x' 2025-07-10 19:42:14 +02:00
tel-config.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
test-execution-events.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
tx.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
web-scoped-beans.adoc Merge branch '6.2.x' 2025-07-10 19:42:14 +02:00