Rename Testcontainers bean startup property

Old name: spring.testcontainers.startup
New name: spring.testcontainers.beans.startup

Closes gh-37073
This commit is contained in:
Moritz Halbritter
2023-10-19 09:22:27 +02:00
parent b8365e3118
commit 55dc2963ef
5 changed files with 5 additions and 5 deletions

View File

@@ -1072,7 +1072,7 @@ include::code:test/MyContainersConfiguration[]
NOTE: The lifecycle of `Container` beans is automatically managed by Spring Boot.
Containers will be started and stopped automatically.
TIP: You can use the configprop:spring.testcontainers.startup[] property to change how containers are started.
TIP: You can use the configprop:spring.testcontainers.beans.startup[] property to change how containers are started.
By default `sequential` startup is used, but you may also choose `parallel` if you wish to start multiple containers in parallel.
Once you have defined your test configuration, you can use the `with(...)` method to attach it to your test launcher:

View File

@@ -61,7 +61,7 @@ public enum TestcontainersStartup {
* The {@link Environment} property used to change the {@link TestcontainersStartup}
* strategy.
*/
public static final String PROPERTY = "spring.testcontainers.startup";
public static final String PROPERTY = "spring.testcontainers.beans.startup";
abstract void start(Collection<? extends Startable> startables);

View File

@@ -1,7 +1,7 @@
{
"properties": [
{
"name": "spring.testcontainers.startup",
"name": "spring.testcontainers.beans.startup",
"type": "org.springframework.boot.testcontainers.lifecycle.TestcontainersStartup",
"description": "Testcontainers startup modes.",
"defaultValue": "sequential"

View File

@@ -114,7 +114,7 @@ class TestcontainersLifecycleApplicationContextInitializerTests {
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
applicationContext.getEnvironment()
.getPropertySources()
.addLast(new MapPropertySource("test", Map.of("spring.testcontainers.startup", "parallel")));
.addLast(new MapPropertySource("test", Map.of("spring.testcontainers.beans.startup", "parallel")));
new TestcontainersLifecycleApplicationContextInitializer().initialize(applicationContext);
AbstractBeanFactory beanFactory = (AbstractBeanFactory) applicationContext.getBeanFactory();
BeanPostProcessor beanPostProcessor = beanFactory.getBeanPostProcessors()

View File

@@ -82,7 +82,7 @@ class TestcontainersStartupTests {
MockEnvironment environment = new MockEnvironment();
assertThatIllegalArgumentException()
.isThrownBy(() -> TestcontainersStartup.get(environment.withProperty(PROPERTY, "bad")))
.withMessage("Unknown 'spring.testcontainers.startup' property value 'bad'");
.withMessage("Unknown 'spring.testcontainers.beans.startup' property value 'bad'");
}
private List<TestStartable> createTestStartables(int size) {