spring-framework/framework-docs/modules/ROOT/pages/testing/annotations/integration-spring
Sam Brannen 81d89f478a Relax singleton enforcement for Bean Overrides in the TestContext framework
In gh-33602, we introduced strict singleton enforcement for bean
overrides -- for example, for @⁠MockitoBean, @⁠TestBean, etc. However,
the use of BeanFactory#isSingleton(beanName) can result in a
BeanCreationException for certain beans, such as a Spring Data JPA
FactoryBean for a JpaRepository.

In light of that, this commit relaxes the singleton enforcement in
BeanOverrideBeanFactoryPostProcessor by only checking the result of
BeanDefinition#isSingleton() for existing bean definitions.

This commit also updates the Javadoc and reference documentation to
reflect the status quo.

See gh-33602
Closes gh-33800
2024-10-28 12:45:05 +01:00
..
annotation-activeprofiles.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-aftertransaction.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-beforetransaction.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-bootstrapwith.adoc Clarify supported targets for annotations in the TestContext framework 2024-05-07 16:45:12 +03:00
annotation-commit.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-contextconfiguration.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-contextcustomizerfactories.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-contexthierarchy.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-dirtiescontext.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +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 Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-mockitobean.adoc Relax singleton enforcement for Bean Overrides in the TestContext framework 2024-10-28 12:45:05 +01:00
annotation-recordapplicationevents.adoc Clarify supported targets for annotations in the TestContext framework 2024-05-07 16:45:12 +03:00
annotation-rollback.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-sql.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-sqlconfig.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-sqlgroup.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-sqlmergemode.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-testbean.adoc Relax singleton enforcement for Bean Overrides in the TestContext framework 2024-10-28 12:45:05 +01:00
annotation-testexecutionlisteners.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-testpropertysource.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
annotation-webappconfiguration.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00