diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index 8225c6b2f8..095c2cc9ea 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -24,7 +24,6 @@ import java.util.Map; import java.util.stream.Stream; import com.mongodb.MongoClientSettings; -import de.flapdoodle.embed.mongo.Command; import de.flapdoodle.embed.mongo.MongodExecutable; import de.flapdoodle.embed.mongo.MongodStarter; import de.flapdoodle.embed.mongo.config.Defaults; @@ -32,10 +31,10 @@ import de.flapdoodle.embed.mongo.config.ImmutableMongodConfig; import de.flapdoodle.embed.mongo.config.MongodConfig; import de.flapdoodle.embed.mongo.config.Net; import de.flapdoodle.embed.mongo.config.Storage; -import de.flapdoodle.embed.mongo.distribution.Feature; import de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion; import de.flapdoodle.embed.mongo.distribution.Version; import de.flapdoodle.embed.mongo.distribution.Versions; +import de.flapdoodle.embed.mongo.packageresolver.Command; import de.flapdoodle.embed.process.config.RuntimeConfig; import de.flapdoodle.embed.process.config.process.ProcessOutput; import de.flapdoodle.embed.process.config.store.DownloadConfig; @@ -146,16 +145,12 @@ public class EmbeddedMongoAutoConfiguration { private IFeatureAwareVersion determineVersion(EmbeddedMongoProperties embeddedProperties) { 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())) { - return version; - } + for (Version version : Version.values()) { + if (version.asInDownloadPath().equals(embeddedProperties.getVersion())) { + return version; } - return Versions.withFeatures(createEmbeddedMongoVersion(embeddedProperties)); } - return Versions.withFeatures(createEmbeddedMongoVersion(embeddedProperties), - embeddedProperties.getFeatures().toArray(new Feature[0])); + return Versions.withFeatures(createEmbeddedMongoVersion(embeddedProperties)); } private GenericVersion createEmbeddedMongoVersion(EmbeddedMongoProperties embeddedProperties) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoProperties.java index 759abb3aa2..47cbae09f5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,6 @@ package org.springframework.boot.autoconfigure.mongo.embedded; -import java.util.Set; - -import de.flapdoodle.embed.mongo.distribution.Feature; - import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.convert.DataSizeUnit; import org.springframework.util.unit.DataSize; @@ -43,12 +39,6 @@ public class EmbeddedMongoProperties { private final Storage storage = new Storage(); - /** - * Comma-separated list of features to enable. Uses the defaults of the configured - * version by default. - */ - private Set features = null; - public String getVersion() { return this.version; } @@ -57,14 +47,6 @@ public class EmbeddedMongoProperties { this.version = version; } - public Set getFeatures() { - return this.features; - } - - public void setFeatures(Set features) { - this.features = features; - } - public Storage getStorage() { return this.storage; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index e7ad61c4ad..7b0e225779 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1618,9 +1618,10 @@ }, { "name": "spring.mongodb.embedded.features", - "defaultValue": [ - "sync_delay" - ] + "deprecation": { + "level": "error", + "reason": "Feature support has been removed from Embedded Mongo. A custom MongodConfig bean should be defined instead." + } }, { "name": "spring.mustache.prefix", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java index d11d088a03..5b36d1ebc1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java @@ -18,9 +18,7 @@ package org.springframework.boot.autoconfigure.mongo.embedded; import java.io.File; import java.nio.file.Path; -import java.util.EnumSet; import java.util.Map; -import java.util.stream.Collectors; import com.mongodb.client.MongoClient; import com.mongodb.client.MongoClients; @@ -28,7 +26,6 @@ import de.flapdoodle.embed.mongo.MongodExecutable; import de.flapdoodle.embed.mongo.MongodStarter; import de.flapdoodle.embed.mongo.config.MongodConfig; import de.flapdoodle.embed.mongo.config.Storage; -import de.flapdoodle.embed.mongo.distribution.Feature; import de.flapdoodle.embed.mongo.distribution.Version; import de.flapdoodle.embed.process.config.RuntimeConfig; import de.flapdoodle.embed.process.config.store.DownloadConfig; @@ -101,15 +98,6 @@ class EmbeddedMongoAutoConfigurationTests { assertVersionConfiguration("3.4.1", "3.4.1"); } - @Test - void customFeatures() { - EnumSet features = EnumSet.of(Feature.TEXT_SEARCH, Feature.SYNC_DELAY, Feature.NO_HTTP_INTERFACE_ARG); - loadWithValidVersion("spring.mongodb.embedded.features=" - + features.stream().map(Feature::name).collect(Collectors.joining(", "))); - assertThat(this.context.getBean(EmbeddedMongoProperties.class).getFeatures()) - .containsExactlyElementsOf(features); - } - @Test void useRandomPortByDefault() { loadWithValidVersion(); diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 95e9ca5b3d..185017430f 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -310,7 +310,7 @@ bom { ] } } - library("Embedded Mongo", "3.3.1") { + library("Embedded Mongo", "3.4.2") { group("de.flapdoodle.embed") { modules = [ "de.flapdoodle.embed.mongo"