问题
不使用AWS环境,Zuul2.1的sample程序是无法启动的。报错如下:
WARN com.netflix.discovery.internal.util.Archaius1Utils [main] Cannot find the properties specified : eureka-client. This may be okay if there are other environment specific properties or the configuration is installed with a different mechanism.
WARN com.netflix.discovery.internal.util.Archaius1Utils [main] Cannot find the properties specified : eureka-client. This may be okay if there are other environment specific properties or the configuration is installed with a different mechanism.
WARN com.netflix.appinfo.AmazonInfo$Builder [main] Skipping the rest of AmazonInfo init as we were not able to load instanceId after the configured number of retries: 3, per fail fast configuration: true
INFO com.netflix.appinfo.RefreshableAmazonInfoProvider [main] Datacenter is: Amazon
分析一下源码,eureka支持三种数据中心:Netflix、Amazon和MyOwn。
BaseServerStartup类使用google inject实现依赖注入。
BaseServerStartup依赖ServerStatusManager和ApplicationInfoManager。
@Inject
public ServerStatusManager(ApplicationInfoManager applicationInfoManager, DiscoveryClient discoveryClient) {
}
@Inject
public ApplicationInfoManager(EurekaInstanceConfig config, InstanceInfo instanceInfo, OptionalArgs optionalArgs) {
}
ApplicationInfoManager依赖EurekaInstanceConfig接口的实现。
@ImplementedBy(CloudInstanceConfig.class)
public interface EurekaInstanceConfig {
}
@Singleton
@ProvidedBy(CloudInstanceConfigProvider.class)
public class CloudInstanceConfig extends PropertiesInstanceConfig implements RefreshableInstanceConfig {
public CloudInstanceConfig(String namespace) {
this(namespace,