15
15
*/
16
16
package org .springframework .data .redis .connection ;
17
17
18
- import static org .springframework .util .StringUtils .* ;
18
+ import static org .springframework .util .StringUtils .commaDelimitedListToSet ;
19
19
20
20
import java .util .Collections ;
21
21
import java .util .HashMap ;
32
32
import org .springframework .util .StringUtils ;
33
33
34
34
/**
35
- * Configuration class used for setting up {@link RedisConnection} via {@link RedisConnectionFactory} using connecting
36
- * to <a href="https://redis.io/topics/sentinel">Redis Sentinel(s)</a>. Useful when setting up a high availability Redis
35
+ * Configuration class used to set up a {@link RedisConnection} with {@link RedisConnectionFactory} for connecting
36
+ * to <a href="https://redis.io/topics/sentinel">Redis Sentinel(s)</a>. Useful when setting up a highly available Redis
37
37
* environment.
38
38
*
39
39
* @author Christoph Strobl
40
40
* @author Thomas Darimont
41
41
* @author Mark Paluch
42
42
* @author Vikas Garg
43
+ * @author John Blum
43
44
* @since 1.4
44
45
*/
45
46
public class RedisSentinelConfiguration implements RedisConfiguration , SentinelConfiguration {
@@ -49,24 +50,27 @@ public class RedisSentinelConfiguration implements RedisConfiguration, SentinelC
49
50
private static final String REDIS_SENTINEL_USERNAME_CONFIG_PROPERTY = "spring.redis.sentinel.username" ;
50
51
private static final String REDIS_SENTINEL_PASSWORD_CONFIG_PROPERTY = "spring.redis.sentinel.password" ;
51
52
52
- private @ Nullable NamedNode master ;
53
- private Set <RedisNode > sentinels ;
54
53
private int database ;
55
54
56
- private @ Nullable String dataNodeUsername = null ;
57
- private @ Nullable String sentinelUsername = null ;
55
+ private @ Nullable NamedNode master ;
56
+
58
57
private RedisPassword dataNodePassword = RedisPassword .none ();
59
58
private RedisPassword sentinelPassword = RedisPassword .none ();
60
59
60
+ private final Set <RedisNode > sentinels ;
61
+
62
+ private @ Nullable String dataNodeUsername = null ;
63
+ private @ Nullable String sentinelUsername = null ;
64
+
61
65
/**
62
- * Creates new {@link RedisSentinelConfiguration}.
66
+ * Creates a new, default {@link RedisSentinelConfiguration}.
63
67
*/
64
68
public RedisSentinelConfiguration () {
65
69
this (new MapPropertySource ("RedisSentinelConfiguration" , Collections .emptyMap ()));
66
70
}
67
71
68
72
/**
69
- * Creates {@link RedisSentinelConfiguration} for given hostPort combinations.
73
+ * Creates a new {@link RedisSentinelConfiguration} for given {@link String hostPort} combinations.
70
74
*
71
75
* <pre>
72
76
* sentinelHostAndPorts[0] = 127.0.0.1:23679 sentinelHostAndPorts[1] = 127.0.0.1:23680 ...
@@ -80,7 +84,8 @@ public RedisSentinelConfiguration(String master, Set<String> sentinelHostAndPort
80
84
}
81
85
82
86
/**
83
- * Creates {@link RedisSentinelConfiguration} looking up values in given {@link PropertySource}.
87
+ * Creates a new {@link RedisSentinelConfiguration} looking up configuration values from the given
88
+ * {@link PropertySource}.
84
89
*
85
90
* <pre>
86
91
* <code>
0 commit comments