Merge branch '3.2.x'

Closes gh-39346
This commit is contained in:
Andy Wilkinson
2024-01-30 16:48:43 +00:00
2 changed files with 31 additions and 4 deletions

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)));
}
@@ -138,7 +138,7 @@ public class TestcontainersPropertySource extends EnumerablePropertySource<Map<S
* to the {@link TestcontainersPropertySource}. This class is a
* {@link BeanFactoryPostProcessor} so that it is initialized as early as possible.
*/
private static class EventPublisherRegistrar implements BeanFactoryPostProcessor, ApplicationEventPublisherAware {
static class EventPublisherRegistrar implements BeanFactoryPostProcessor, ApplicationEventPublisherAware {
static final String NAME = EventPublisherRegistrar.class.getName();