spring-framework/framework-docs/modules/ROOT/pages/testing/annotations
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
..
integration-spring Relax singleton enforcement for Bean Overrides in the TestContext framework 2024-10-28 12:45:05 +01:00
integration-junit-jupiter.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
integration-junit4.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
integration-meta.adoc Remove obsolete role attributes for tab groups in the reference manual 2024-09-08 17:20:10 +02:00
integration-spring.adoc Polish "Bean Overriding in Tests" support 2024-04-16 17:08:15 +02:00
integration-standard.adoc Fix cross references 2023-05-04 15:35:05 +01:00