Fix Embedded Mongo classpath check

This commit changes the classpath check condition to verify that the
core module of the MongoDB driver is present. Previously, we were only
checking for the presence of the sync driver, making embedded support
unavailable with the reactive variant.

Closes gh-19960
pull/20022/head
Stephane Nicoll 5 years ago
parent b2c0d1d3d6
commit 5833d2c5e8

@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
import com.mongodb.client.MongoClient;
import com.mongodb.MongoClientSettings;
import de.flapdoodle.embed.mongo.Command;
import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodStarter;
@ -86,7 +86,7 @@ import org.springframework.data.mongodb.core.ReactiveMongoClientFactoryBean;
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties({ MongoProperties.class, EmbeddedMongoProperties.class })
@AutoConfigureBefore(MongoAutoConfiguration.class)
@ConditionalOnClass({ MongoClient.class, MongodStarter.class })
@ConditionalOnClass({ MongoClientSettings.class, MongodStarter.class })
@Import({ EmbeddedMongoClientDependsOnBeanFactoryPostProcessor.class,
EmbeddedReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor.class })
public class EmbeddedMongoAutoConfiguration {
@ -217,10 +217,10 @@ public class EmbeddedMongoAutoConfiguration {
}
/**
* Post processor to ensure that {@link MongoClient} beans depend on any
* {@link MongodExecutable} beans.
* Post processor to ensure that {@link com.mongodb.client.MongoClient} beans depend
* on any {@link MongodExecutable} beans.
*/
@ConditionalOnClass({ MongoClient.class, MongoClientFactoryBean.class })
@ConditionalOnClass({ com.mongodb.client.MongoClient.class, MongoClientFactoryBean.class })
static class EmbeddedMongoClientDependsOnBeanFactoryPostProcessor
extends MongoClientDependsOnBeanFactoryPostProcessor {

Loading…
Cancel
Save