From 481305cd3102f9b905a30beaecc0624545e02bb1 Mon Sep 17 00:00:00 2001 From: G1 Date: Tue, 7 Mar 2023 14:40:02 +0900 Subject: [PATCH] feat: Uses StringUtils.commaDelimitedListToStringArray instead --- .../config/LoadBalancerAutoConfiguration.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/config/LoadBalancerAutoConfiguration.java b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/config/LoadBalancerAutoConfiguration.java index 711749828..1228e29b3 100644 --- a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/config/LoadBalancerAutoConfiguration.java +++ b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/config/LoadBalancerAutoConfiguration.java @@ -16,6 +16,7 @@ package org.springframework.cloud.loadbalancer.config; +import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -37,6 +38,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; +import org.springframework.util.StringUtils; /** * @author Spencer Gibb @@ -51,14 +53,12 @@ @ConditionalOnProperty(value = "spring.cloud.loadbalancer.enabled", havingValue = "true", matchIfMissing = true) public class LoadBalancerAutoConfiguration { - private static final String ZONE_SPLITTER_COMMA = ","; - @Bean @ConditionalOnMissingBean public LoadBalancerZoneConfig zoneConfig(Environment environment) { return new LoadBalancerZoneConfig(environment.getProperty("spring.cloud.loadbalancer.zone"), - List.of(environment.getProperty("spring.cloud.loadbalancer.secondary-zones", "") - .split(ZONE_SPLITTER_COMMA))); + Arrays.stream(StringUtils.commaDelimitedListToStringArray(environment.getProperty("spring.cloud.loadbalancer.secondary-zones", ""))) + .toList()); } @ConditionalOnMissingBean