diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonLoadBalancerClient.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonLoadBalancerClient.java index edc92025..244512d6 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonLoadBalancerClient.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonLoadBalancerClient.java @@ -105,15 +105,11 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient { if (config != null) { return config.get(CommonClientConfigKey.IsSecure, false); } - if (ClassUtils.isPresent("com.netflix.niws.loadbalancer.DiscoveryEnabledServer", - null)) { - if (server instanceof DiscoveryEnabledServer) { - DiscoveryEnabledServer enabled = (DiscoveryEnabledServer) server; - return enabled.getInstanceInfo().isPortEnabled(PortType.SECURE); - } + ServerIntrospector serverIntrospector = clientFactory.getInstance(serviceId, ServerIntrospector.class); + if (serverIntrospector == null) { + serverIntrospector = new DefaultServerIntrospector(); } - // Can we do better? - return ("" + server.getPort()).endsWith("443"); + return serverIntrospector.isSecure(server); } private void recordStats(RibbonLoadBalancerContext context, Stopwatch tracer,