Skip to content

Commit 4fd9626

Browse files
NeatGuyCodingsnicoll
authored andcommitted
Validate node configuration with static master replica
See gh-47401 Signed-off-by: NeatGuyCoding <[email protected]>
1 parent 8a9528e commit 4fd9626

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

module/spring-boot-data-redis/src/main/java/org/springframework/boot/data/redis/autoconfigure/DataRedisConnectionConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ protected final RedisStandaloneConfiguration getStandaloneConfig() {
154154
}
155155
if (this.connectionDetails.getMasterReplica() != null) {
156156
List<Node> nodes = this.connectionDetails.getMasterReplica().getNodes();
157+
Assert.state(!nodes.isEmpty(), "At least one node is required for master-replica configuration");
157158
RedisStaticMasterReplicaConfiguration config = new RedisStaticMasterReplicaConfiguration(
158159
nodes.get(0).host(), nodes.get(0).port());
159160
nodes.stream().skip(1).forEach((node) -> config.addNode(node.host(), node.port()));

0 commit comments

Comments
 (0)