spring-framework/framework-docs/modules/ROOT/pages/testing
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
..
annotations Support Bean Overrides for non-singletons 2025-10-07 15:33:18 +02:00
mockmvc Fix broken link in WebDriver docs 2025-08-23 13:41:40 +02:00
testcontext-framework Support Bean Overrides for non-singletons 2025-10-07 15:33:18 +02:00
annotations.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
appendix.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
integration.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
introduction.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00
mockmvc.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
resources.adoc Restructure content in testing resources section 2024-09-12 13:37:58 +02:00
resttestclient.adoc Formatting issue in RestTestClient documentation 2025-08-14 15:59:28 +02:00
spring-mvc-test-client.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
support-jdbc.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
testcontext-framework.adoc Merge branch '6.2.x' 2025-07-10 19:42:14 +02:00
unit.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
webtestclient.adoc Merge branch '6.2.x' 2025-07-10 19:42:14 +02:00