Commit 2003c5e1 authored by Julien May's avatar Julien May Committed by Stephane Nicoll

Add condition on MongoClientFactoryBean

This commit makes sure that the condition that links a `MongoClient` to
the embedded mongo server kicks in only if `MongoClientFactoryBean` is
also on the classpath.

Previously, only a condition on the mongo driver existed, leading to
`ClassNotFoundException` if Spring Data MongoDB wasn't available.

See gh-6203
parent 17f8a244
...@@ -63,6 +63,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -63,6 +63,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource; import org.springframework.core.env.PropertySource;
import org.springframework.data.mongodb.core.MongoClientFactoryBean;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
...@@ -199,7 +200,7 @@ public class EmbeddedMongoAutoConfiguration { ...@@ -199,7 +200,7 @@ public class EmbeddedMongoAutoConfiguration {
* {@code embeddedMongoServer} bean. * {@code embeddedMongoServer} bean.
*/ */
@Configuration @Configuration
@ConditionalOnClass(MongoClient.class) @ConditionalOnClass({MongoClient.class, MongoClientFactoryBean.class})
protected static class EmbeddedMongoDependencyConfiguration protected static class EmbeddedMongoDependencyConfiguration
extends MongoClientDependsOnBeanFactoryPostProcessor { extends MongoClientDependsOnBeanFactoryPostProcessor {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment