Skip to content

Commit 609a304

Browse files
committed
Merge pull request spring-projects#15692 from Eugene Tenkaev
* spring-projectsgh-15692: Polish "Fix stopping of Embedded Mongo before context is closed" Fix stopping of Embedded Mongo before context is closed Closes spring-projectsgh-15692
2 parents 08ce814 + 20f26c4 commit 609a304

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -212,7 +212,7 @@ public IRuntimeConfig embeddedMongoRuntimeConfig() {
212212
"[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG)));
213213
return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger)
214214
.processOutput(processOutput).artifactStore(getArtifactStore(logger))
215-
.build();
215+
.daemonProcess(false).build();
216216
}
217217

218218
private ArtifactStoreBuilder getArtifactStore(Logger logger) {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121
import java.util.stream.Collectors;
2222

2323
import com.mongodb.MongoClient;
24+
import de.flapdoodle.embed.mongo.MongodExecutable;
2425
import de.flapdoodle.embed.mongo.config.IMongodConfig;
2526
import de.flapdoodle.embed.mongo.config.Storage;
2627
import de.flapdoodle.embed.mongo.distribution.Feature;
@@ -174,6 +175,13 @@ public void customReplicaSetNameIsAppliedToConfiguration() {
174175
.isEqualTo("testing");
175176
}
176177

178+
@Test
179+
public void shutdownHookIsNotRegistered() {
180+
load();
181+
assertThat(this.context.getBean(MongodExecutable.class).isRegisteredJobKiller())
182+
.isFalse();
183+
}
184+
177185
private void assertVersionConfiguration(String configuredVersion,
178186
String expectedVersion) {
179187
this.context = new AnnotationConfigApplicationContext();

0 commit comments

Comments
 (0)