spring-framework/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring
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
..
annotation-activeprofiles.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-aftertransaction.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-beforetransaction.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-bootstrapwith.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-commit.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-contextconfiguration.adoc Polishing 2025-06-25 10:22:47 +02:00
annotation-contextcustomizerfactories.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-contexthierarchy.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-dirtiescontext.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-disabledinaotmode.adoc Clarify supported targets for annotations in the TestContext framework 2024-05-07 16:45:12 +03:00
annotation-dynamicpropertysource.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-mockitobean.adoc Support Bean Overrides for non-singletons 2025-10-07 15:33:18 +02:00
annotation-recordapplicationevents.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-rollback.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-sql.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-sqlconfig.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-sqlgroup.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-sqlmergemode.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-testbean.adoc Support Bean Overrides for non-singletons 2025-10-07 15:33:18 +02:00
annotation-testexecutionlisteners.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-testpropertysource.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
annotation-webappconfiguration.adoc Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00