2020
2121import com .mongodb .ConnectionString ;
2222import org .bson .UuidRepresentation ;
23+ import org .jspecify .annotations .Nullable ;
2324
2425import org .springframework .boot .context .properties .ConfigurationProperties ;
2526
@@ -59,56 +60,56 @@ public class MongoProperties {
5960 /**
6061 * Mongo server host. Ignored if 'uri' is set.
6162 */
62- private String host ;
63+ private @ Nullable String host ;
6364
6465 /**
6566 * Mongo server port. Ignored if 'uri' is set.
6667 */
67- private Integer port = null ;
68+ private @ Nullable Integer port ;
6869
6970 /**
7071 * Additional server hosts. Ignored if 'uri' is set or if 'host' is omitted.
7172 * Additional hosts will use the default mongo port of 27017. If you want to use a
7273 * different port you can use the "host:port" syntax.
7374 */
74- private List <String > additionalHosts ;
75+ private @ Nullable List <String > additionalHosts ;
7576
7677 /**
7778 * Mongo database URI. Overrides host, port, username, and password.
7879 */
79- private String uri ;
80+ private @ Nullable String uri ;
8081
8182 /**
8283 * Database name. Overrides database in URI.
8384 */
84- private String database ;
85+ private @ Nullable String database ;
8586
8687 /**
8788 * Authentication database name.
8889 */
89- private String authenticationDatabase ;
90+ private @ Nullable String authenticationDatabase ;
9091
9192 private final Gridfs gridfs = new Gridfs ();
9293
9394 /**
9495 * Login user of the mongo server. Ignored if 'uri' is set.
9596 */
96- private String username ;
97+ private @ Nullable String username ;
9798
9899 /**
99100 * Login password of the mongo server. Ignored if 'uri' is set.
100101 */
101- private char [] password ;
102+ private char @ Nullable [] password ;
102103
103104 /**
104105 * Required replica set name for the cluster. Ignored if 'uri' is set.
105106 */
106- private String replicaSetName ;
107+ private @ Nullable String replicaSetName ;
107108
108109 /**
109110 * Fully qualified name of the FieldNamingStrategy to use.
110111 */
111- private Class <?> fieldNamingStrategy ;
112+ private @ Nullable Class <?> fieldNamingStrategy ;
112113
113114 /**
114115 * Representation to use when converting a UUID to a BSON binary value.
@@ -120,7 +121,7 @@ public class MongoProperties {
120121 /**
121122 * Whether to enable auto-index creation.
122123 */
123- private Boolean autoIndexCreation ;
124+ private @ Nullable Boolean autoIndexCreation ;
124125
125126 public void setProtocol (String protocol ) {
126127 this .protocol = protocol ;
@@ -130,59 +131,59 @@ public String getProtocol() {
130131 return this .protocol ;
131132 }
132133
133- public String getHost () {
134+ public @ Nullable String getHost () {
134135 return this .host ;
135136 }
136137
137- public void setHost (String host ) {
138+ public void setHost (@ Nullable String host ) {
138139 this .host = host ;
139140 }
140141
141- public String getDatabase () {
142+ public @ Nullable String getDatabase () {
142143 return this .database ;
143144 }
144145
145- public void setDatabase (String database ) {
146+ public void setDatabase (@ Nullable String database ) {
146147 this .database = database ;
147148 }
148149
149- public String getAuthenticationDatabase () {
150+ public @ Nullable String getAuthenticationDatabase () {
150151 return this .authenticationDatabase ;
151152 }
152153
153- public void setAuthenticationDatabase (String authenticationDatabase ) {
154+ public void setAuthenticationDatabase (@ Nullable String authenticationDatabase ) {
154155 this .authenticationDatabase = authenticationDatabase ;
155156 }
156157
157- public String getUsername () {
158+ public @ Nullable String getUsername () {
158159 return this .username ;
159160 }
160161
161- public void setUsername (String username ) {
162+ public void setUsername (@ Nullable String username ) {
162163 this .username = username ;
163164 }
164165
165- public char [] getPassword () {
166+ public char @ Nullable [] getPassword () {
166167 return this .password ;
167168 }
168169
169- public void setPassword (char [] password ) {
170+ public void setPassword (char @ Nullable [] password ) {
170171 this .password = password ;
171172 }
172173
173- public String getReplicaSetName () {
174+ public @ Nullable String getReplicaSetName () {
174175 return this .replicaSetName ;
175176 }
176177
177- public void setReplicaSetName (String replicaSetName ) {
178+ public void setReplicaSetName (@ Nullable String replicaSetName ) {
178179 this .replicaSetName = replicaSetName ;
179180 }
180181
181- public Class <?> getFieldNamingStrategy () {
182+ public @ Nullable Class <?> getFieldNamingStrategy () {
182183 return this .fieldNamingStrategy ;
183184 }
184185
185- public void setFieldNamingStrategy (Class <?> fieldNamingStrategy ) {
186+ public void setFieldNamingStrategy (@ Nullable Class <?> fieldNamingStrategy ) {
186187 this .fieldNamingStrategy = fieldNamingStrategy ;
187188 }
188189
@@ -194,50 +195,50 @@ public void setUuidRepresentation(UuidRepresentation uuidRepresentation) {
194195 this .uuidRepresentation = uuidRepresentation ;
195196 }
196197
197- public String getUri () {
198+ public @ Nullable String getUri () {
198199 return this .uri ;
199200 }
200201
201202 public String determineUri () {
202203 return (this .uri != null ) ? this .uri : DEFAULT_URI ;
203204 }
204205
205- public void setUri (String uri ) {
206+ public void setUri (@ Nullable String uri ) {
206207 this .uri = uri ;
207208 }
208209
209- public Integer getPort () {
210+ public @ Nullable Integer getPort () {
210211 return this .port ;
211212 }
212213
213- public void setPort (Integer port ) {
214+ public void setPort (@ Nullable Integer port ) {
214215 this .port = port ;
215216 }
216217
217218 public Gridfs getGridfs () {
218219 return this .gridfs ;
219220 }
220221
221- public String getMongoClientDatabase () {
222+ public @ Nullable String getMongoClientDatabase () {
222223 if (this .database != null ) {
223224 return this .database ;
224225 }
225226 return new ConnectionString (determineUri ()).getDatabase ();
226227 }
227228
228- public Boolean isAutoIndexCreation () {
229+ public @ Nullable Boolean isAutoIndexCreation () {
229230 return this .autoIndexCreation ;
230231 }
231232
232- public void setAutoIndexCreation (Boolean autoIndexCreation ) {
233+ public void setAutoIndexCreation (@ Nullable Boolean autoIndexCreation ) {
233234 this .autoIndexCreation = autoIndexCreation ;
234235 }
235236
236- public List <String > getAdditionalHosts () {
237+ public @ Nullable List <String > getAdditionalHosts () {
237238 return this .additionalHosts ;
238239 }
239240
240- public void setAdditionalHosts (List <String > additionalHosts ) {
241+ public void setAdditionalHosts (@ Nullable List <String > additionalHosts ) {
241242 this .additionalHosts = additionalHosts ;
242243 }
243244
@@ -250,26 +251,26 @@ public static class Gridfs {
250251 /**
251252 * GridFS database name.
252253 */
253- private String database ;
254+ private @ Nullable String database ;
254255
255256 /**
256257 * GridFS bucket name.
257258 */
258- private String bucket ;
259+ private @ Nullable String bucket ;
259260
260- public String getDatabase () {
261+ public @ Nullable String getDatabase () {
261262 return this .database ;
262263 }
263264
264- public void setDatabase (String database ) {
265+ public void setDatabase (@ Nullable String database ) {
265266 this .database = database ;
266267 }
267268
268- public String getBucket () {
269+ public @ Nullable String getBucket () {
269270 return this .bucket ;
270271 }
271272
272- public void setBucket (String bucket ) {
273+ public void setBucket (@ Nullable String bucket ) {
273274 this .bucket = bucket ;
274275 }
275276
@@ -281,12 +282,12 @@ public static class Ssl {
281282 * Whether to enable SSL support. Enabled automatically if "bundle" is provided
282283 * unless specified otherwise.
283284 */
284- private Boolean enabled ;
285+ private @ Nullable Boolean enabled ;
285286
286287 /**
287288 * SSL bundle name.
288289 */
289- private String bundle ;
290+ private @ Nullable String bundle ;
290291
291292 public boolean isEnabled () {
292293 return (this .enabled != null ) ? this .enabled : this .bundle != null ;
@@ -296,11 +297,11 @@ public void setEnabled(boolean enabled) {
296297 this .enabled = enabled ;
297298 }
298299
299- public String getBundle () {
300+ public @ Nullable String getBundle () {
300301 return this .bundle ;
301302 }
302303
303- public void setBundle (String bundle ) {
304+ public void setBundle (@ Nullable String bundle ) {
304305 this .bundle = bundle ;
305306 }
306307
0 commit comments