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
1 changed files with 1 additions and 1 deletions

View File

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