Skip to content

Commit 2bfd784

Browse files
committed
Revert "Prevent duplicate DynamicPropertyRegistry beans"
This partially reverts commit 4d4b189. The changes to main code are no longer needed as Framework's test context framework no longer defines a DynamicPropertyRegistry bean. The changes to test code have been kept to verify that @SpringBootTest and TestcontainersPropertySourceAutoConfiguration continue to work in combination. Closes gh-42275
1 parent 8628f73 commit 2bfd784

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616

1717
package org.springframework.boot.testcontainers.properties;
1818

19-
import org.springframework.beans.BeansException;
20-
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
21-
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
22-
import org.springframework.beans.factory.support.DefaultSingletonBeanRegistry;
2319
import org.springframework.boot.autoconfigure.AutoConfiguration;
2420
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2521
import org.springframework.context.ConfigurableApplicationContext;
@@ -43,27 +39,9 @@ public class TestcontainersPropertySourceAutoConfiguration {
4339
TestcontainersPropertySourceAutoConfiguration() {
4440
}
4541

46-
@Bean
47-
static RemoveTestDynamicPropertyRegistryBeanPostProcessor removeTestDynamicPropertyRegistryBeanPostProcessor() {
48-
return new RemoveTestDynamicPropertyRegistryBeanPostProcessor();
49-
}
50-
5142
@Bean
5243
static DynamicPropertyRegistry dynamicPropertyRegistry(ConfigurableApplicationContext applicationContext) {
5344
return TestcontainersPropertySource.attach(applicationContext);
5445
}
5546

56-
static class RemoveTestDynamicPropertyRegistryBeanPostProcessor implements BeanFactoryPostProcessor {
57-
58-
@Override
59-
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
60-
if (beanFactory instanceof DefaultSingletonBeanRegistry singletonBeanRegistry) {
61-
singletonBeanRegistry
62-
.destroySingleton("org.springframework.test.context.support.DynamicPropertiesContextCustomizer"
63-
+ ".dynamicPropertyRegistry");
64-
}
65-
}
66-
67-
}
68-
6947
}

0 commit comments

Comments
 (0)