From 2f288bf614db0e90b15a36152a022cfc60b1487d Mon Sep 17 00:00:00 2001 From: Dmytro Nosan Date: Thu, 20 Feb 2025 15:21:53 +0200 Subject: [PATCH 1/2] Clarify which Mongo properties are ignored when URI property is set See gh-44384 Signed-off-by: Dmytro Nosan --- .../autoconfigure/mongo/MongoProperties.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java index 768d52c5b74..cca3c8bb8f1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 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. @@ -52,19 +52,19 @@ public class MongoProperties { public static final String DEFAULT_URI = "mongodb://localhost/test"; /** - * Mongo server host. Cannot be set with URI. + * Mongo server host. Ignored if Mongo 'uri' is specified. */ private String host; /** - * Mongo server port. Cannot be set with URI. + * Mongo server port. Ignored if Mongo 'uri' is specified. */ private Integer port = null; /** - * Additional server hosts. Cannot be set with URI or if 'host' is not specified. - * Additional hosts will use the default mongo port of 27017. If you want to use a - * different port you can use the "host:port" syntax. + * Additional server hosts. Ignored if a Mongo 'uri' is provided or if 'host' is + * omitted. Additional hosts will use the default mongo port of 27017. If you want to + * use a different port you can use the "host:port" syntax. */ private List additionalHosts; @@ -86,17 +86,17 @@ public class MongoProperties { private final Gridfs gridfs = new Gridfs(); /** - * Login user of the mongo server. Cannot be set with URI. + * Login user of the mongo server. Ignored if Mongo 'uri' is specified. */ private String username; /** - * Login password of the mongo server. Cannot be set with URI. + * Login password of the mongo server. Ignored if Mongo 'uri' is specified. */ private char[] password; /** - * Required replica set name for the cluster. Cannot be set with URI. + * Required replica set name for the cluster. Ignored if Mongo 'uri' is specified. */ private String replicaSetName; From 7fd19556b24bd21e76c1afac03d4ac67b18d5c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Sat, 22 Feb 2025 18:32:19 +0100 Subject: [PATCH 2/2] Polish contribution See gh-44384 --- .../autoconfigure/mongo/MongoProperties.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java index cca3c8bb8f1..740c97dff7f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java @@ -52,19 +52,19 @@ public class MongoProperties { public static final String DEFAULT_URI = "mongodb://localhost/test"; /** - * Mongo server host. Ignored if Mongo 'uri' is specified. + * Mongo server host. Ignored if 'uri' is set. */ private String host; /** - * Mongo server port. Ignored if Mongo 'uri' is specified. + * Mongo server port. Ignored if 'uri' is set. */ private Integer port = null; /** - * Additional server hosts. Ignored if a Mongo 'uri' is provided or if 'host' is - * omitted. Additional hosts will use the default mongo port of 27017. If you want to - * use a different port you can use the "host:port" syntax. + * Additional server hosts. Ignored if 'uri' is set or if 'host' is omitted. + * Additional hosts will use the default mongo port of 27017. If you want to use a + * different port you can use the "host:port" syntax. */ private List additionalHosts; @@ -86,17 +86,17 @@ public class MongoProperties { private final Gridfs gridfs = new Gridfs(); /** - * Login user of the mongo server. Ignored if Mongo 'uri' is specified. + * Login user of the mongo server. Ignored if 'uri' is set. */ private String username; /** - * Login password of the mongo server. Ignored if Mongo 'uri' is specified. + * Login password of the mongo server. Ignored if 'uri' is set. */ private char[] password; /** - * Required replica set name for the cluster. Ignored if Mongo 'uri' is specified. + * Required replica set name for the cluster. Ignored if 'uri' is set. */ private String replicaSetName;