Prevent double registration of event publisher registrar

See gh-39297
This commit is contained in:
tish
2024-01-25 07:59:49 +04:00
committed by Andy Wilkinson
parent 8c18d75b12
commit 50c44e301a

View File

@@ -115,7 +115,7 @@ public class TestcontainersPropertySource extends EnumerablePropertySource<Map<S
if (eventPublisher != null) {
propertySource.addEventPublisher(eventPublisher);
}
else if (registry != null) {
else if (registry != null && !registry.containsBeanDefinition(EventPublisherRegistrar.NAME)) {
registry.registerBeanDefinition(EventPublisherRegistrar.NAME, new RootBeanDefinition(
EventPublisherRegistrar.class, () -> new EventPublisherRegistrar(environment)));
}