Commit 187af715 by Spencer Gibb

move refs to EurekaInstanceConfigBean to interface.

Specifically CloudEurekaInstanceConfig where needed. see gh-302
parent 4877de49
......@@ -26,6 +26,7 @@ import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
import com.netflix.appinfo.EurekaInstanceConfig;
import com.netflix.discovery.EurekaClient;
/**
......@@ -40,7 +41,7 @@ import com.netflix.discovery.EurekaClient;
public class EurekaClientConfigServerAutoConfiguration {
@Autowired(required = false)
private EurekaInstanceConfigBean instance;
private EurekaInstanceConfig instance;
@Autowired(required = false)
private ConfigServerProperties server;
......
/*
* Copyright 2013-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.eureka;
import com.netflix.appinfo.EurekaInstanceConfig;
import com.netflix.appinfo.InstanceInfo;
/**
* @author Spencer Gibb
*/
public interface CloudEurekaInstanceConfig extends EurekaInstanceConfig {
void setNonSecurePort(int port);
InstanceInfo.InstanceStatus getInitialStatus();
}
......@@ -69,7 +69,7 @@ public class EurekaDiscoveryClientConfiguration implements SmartLifecycle, Order
private AtomicInteger port = new AtomicInteger(0);
@Autowired
private EurekaInstanceConfigBean instanceConfig;
private CloudEurekaInstanceConfig instanceConfig;
@Autowired(required = false)
private HealthCheckHandler healthCheckHandler;
......
......@@ -33,7 +33,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.util.InetUtils.HostInfo;
import com.netflix.appinfo.DataCenterInfo;
import com.netflix.appinfo.EurekaInstanceConfig;
import com.netflix.appinfo.InstanceInfo.InstanceStatus;
import com.netflix.appinfo.MyDataCenterInfo;
......@@ -43,7 +42,7 @@ import com.netflix.appinfo.MyDataCenterInfo;
*/
@Data
@ConfigurationProperties("eureka.instance")
public class EurekaInstanceConfigBean implements EurekaInstanceConfig {
public class EurekaInstanceConfigBean implements CloudEurekaInstanceConfig {
private static final Log logger = LogFactory.getLog(EurekaInstanceConfigBean.class);
......
......@@ -26,12 +26,12 @@ import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.cloud.netflix.ribbon.ServerIntrospector;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
import com.netflix.appinfo.EurekaInstanceConfig;
import com.netflix.client.config.IClientConfig;
import com.netflix.config.ConfigurationManager;
import com.netflix.config.DeploymentContext.ContextKey;
......@@ -70,13 +70,13 @@ public class EurekaRibbonClientConfiguration {
private EurekaClientConfig clientConfig;
@Autowired
private EurekaInstanceConfigBean eurekaConfig;
private EurekaInstanceConfig eurekaConfig;
public EurekaRibbonClientConfiguration() {
}
public EurekaRibbonClientConfiguration(EurekaClientConfig clientConfig,
String serviceId, EurekaInstanceConfigBean eurekaConfig,
String serviceId, EurekaInstanceConfig eurekaConfig,
boolean approximateZoneFromHostname) {
this.clientConfig = clientConfig;
this.serviceId = serviceId;
......@@ -114,7 +114,7 @@ public class EurekaRibbonClientConfiguration {
if (this.clientConfig != null && StringUtils.isEmpty(zone)) {
if (approximateZoneFromHostname) {
String approxZone = ZoneUtils.extractApproximateZone(eurekaConfig
.getHostname());
.getHostName(false));
log.debug("Setting Zone To " + approxZone);
ConfigurationManager.getDeploymentContext().setValue(ContextKey.zone,
approxZone);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment