diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/DefaultServiceInstance.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/DefaultServiceInstance.java index b41701d2..a8bbc0ac 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/DefaultServiceInstance.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/DefaultServiceInstance.java @@ -17,8 +17,8 @@ package org.springframework.cloud.client; import java.net.URI; -import java.util.Arrays; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -33,6 +33,8 @@ import java.util.Objects; */ public class DefaultServiceInstance implements ServiceInstance { + private final List secureSchemes = List.of("https", "wss"); + private String instanceId; private String serviceId; @@ -49,6 +51,7 @@ public class DefaultServiceInstance implements ServiceInstance { private URI uri; + /** * @param instanceId the id of the instance. * @param serviceId the id of the service. @@ -181,7 +184,7 @@ public class DefaultServiceInstance implements ServiceInstance { this.host = this.uri.getHost(); this.port = this.uri.getPort(); scheme = this.uri.getScheme(); - if (Arrays.asList("https", "wss").contains(scheme)) { + if (secureSchemes.contains(scheme)) { this.secure = true; } }