Polish "Remove default spring.mongodb.embedded.version"

See gh-27108
This commit is contained in:
Andy Wilkinson
2021-07-13 10:13:43 +01:00
parent d16ecab24b
commit 4d76660f17
5 changed files with 12 additions and 10 deletions

View File

@@ -145,7 +145,8 @@ public class EmbeddedMongoAutoConfiguration {
}
private IFeatureAwareVersion determineVersion(EmbeddedMongoProperties embeddedProperties) {
Assert.state(embeddedProperties.getVersion() != null, "Version must be set to use Embedded MongoDB.");
Assert.state(embeddedProperties.getVersion() != null, "Set the spring.mongodb.embedded.version property or "
+ "define your own MongodConfig bean to use embedded MongoDB");
if (embeddedProperties.getFeatures() == null) {
for (Version version : Version.values()) {
if (version.asInDownloadPath().equals(embeddedProperties.getVersion())) {

View File

@@ -81,7 +81,8 @@ class EmbeddedMongoAutoConfigurationTests {
this.context.register(MongoAutoConfiguration.class, MongoDataAutoConfiguration.class,
EmbeddedMongoAutoConfiguration.class);
assertThatThrownBy(() -> this.context.refresh()).hasRootCauseExactlyInstanceOf(IllegalStateException.class)
.hasRootCauseMessage("Version must be set to use Embedded MongoDB.");
.hasRootCauseMessage("Set the spring.mongodb.embedded.version property or define your own MongodConfig "
+ "bean to use embedded MongoDB");
}
@Test