mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Apply customizers to build when created embedded Mongo client
Closes gh-11132
This commit is contained in:
parent
45e8c237de
commit
51b56782a3
@ -92,6 +92,7 @@ public class ReactiveMongoClientFactory {
|
||||
ClusterSettings clusterSettings = ClusterSettings.builder()
|
||||
.hosts(Collections.singletonList(new ServerAddress(host, port))).build();
|
||||
builder.clusterSettings(clusterSettings);
|
||||
customize(builder);
|
||||
return MongoClients.create(builder.build());
|
||||
}
|
||||
|
||||
|
@ -161,6 +161,16 @@ public class ReactiveMongoClientFactoryTests {
|
||||
verify(customizer).customize(any(MongoClientSettings.Builder.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customizerIsInvokedForEmbeddedMongo() {
|
||||
MongoProperties properties = new MongoProperties();
|
||||
this.environment.setProperty("local.mongo.port", "27017");
|
||||
MongoClientSettingsBuilderCustomizer customizer = mock(
|
||||
MongoClientSettingsBuilderCustomizer.class);
|
||||
createMongoClient(properties, this.environment, customizer);
|
||||
verify(customizer).customize(any(MongoClientSettings.Builder.class));
|
||||
}
|
||||
|
||||
private MongoClient createMongoClient(MongoProperties properties) {
|
||||
return createMongoClient(properties, this.environment);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user