From 4d031999ce305db381a7affaeeb882294944ccd4 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 6 Sep 2018 14:51:10 +0200 Subject: [PATCH] Polish "Fix use of deprecated Mongo API" Closes gh-14318 --- .../boot/autoconfigure/mongo/ReactiveMongoClientFactory.java | 4 ++-- .../mongo/MongoReactiveAutoConfigurationTests.java | 2 +- .../autoconfigure/mongo/ReactiveMongoClientFactoryTests.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java index 1e35a54bc60..5eb50e3d46f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java @@ -83,7 +83,7 @@ public class ReactiveMongoClientFactory { Builder builder = builder(settings); String host = (this.properties.getHost() != null) ? this.properties.getHost() : "localhost"; - builder.applyToClusterSettings(cluster -> cluster + builder.applyToClusterSettings((cluster) -> cluster .hosts(Collections.singletonList(new ServerAddress(host, port)))); return createMongoClient(builder); } @@ -108,7 +108,7 @@ public class ReactiveMongoClientFactory { int port = getOrDefault(this.properties.getPort(), MongoProperties.DEFAULT_PORT); ServerAddress serverAddress = new ServerAddress(host, port); builder.applyToClusterSettings( - cluster -> cluster.hosts(Collections.singletonList(serverAddress))); + (cluster) -> cluster.hosts(Collections.singletonList(serverAddress))); return createMongoClient(builder); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java index c430b69a080..fa065c49e68 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java @@ -121,7 +121,7 @@ public class MongoReactiveAutoConfigurationTests { public MongoClientSettings mongoClientSettings() { return MongoClientSettings.builder().readPreference(ReadPreference.nearest()) .applyToSocketSettings( - socket -> socket.readTimeout(300, TimeUnit.SECONDS)) + (socket) -> socket.readTimeout(300, TimeUnit.SECONDS)) .build(); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactoryTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactoryTests.java index 9751c9bc2ea..5a9e30c3103 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactoryTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactoryTests.java @@ -19,9 +19,9 @@ package org.springframework.boot.autoconfigure.mongo; import java.util.Arrays; import java.util.List; +import com.mongodb.MongoClientSettings; import com.mongodb.MongoCredential; import com.mongodb.ServerAddress; -import com.mongodb.MongoClientSettings; import com.mongodb.connection.ClusterSettings; import com.mongodb.reactivestreams.client.MongoClient; import org.junit.Rule;