From e2a1b819c693905d0aa22aa91b477c428ed0dd86 Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Tue, 8 Nov 2022 17:03:14 +0100 Subject: [PATCH] Adjust after review. --- .../cloud/client/DefaultServiceInstance.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; } }