Skip to content

Commit 50c44e3

Browse files
tishwilkinsona
authored andcommitted
Prevent double registration of event publisher registrar
See gh-39297
1 parent 8c18d75 commit 50c44e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/properties/TestcontainersPropertySource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private static DynamicPropertyRegistry attach(Environment environment, Applicati
115115
if (eventPublisher != null) {
116116
propertySource.addEventPublisher(eventPublisher);
117117
}
118-
else if (registry != null) {
118+
else if (registry != null && !registry.containsBeanDefinition(EventPublisherRegistrar.NAME)) {
119119
registry.registerBeanDefinition(EventPublisherRegistrar.NAME, new RootBeanDefinition(
120120
EventPublisherRegistrar.class, () -> new EventPublisherRegistrar(environment)));
121121
}

0 commit comments

Comments
 (0)