首先声明,我并没有直接使用Spring Cloud Config,而是通过Spring Cloud Hystrix starter来进行传递。
当仅使用@EnableHystrix
时,Spring Cloud也会尝试查找配置服务器,但是由于我没有使用配置服务器,所以这将不出所料地失败。据我所知,应用程序运行得非常好,但问题在于状态检查。由于没有配置服务器,健康状态显示为DOWN
。
浏览项目源代码后,我希望spring.cloud.config.enabled=false
可以禁用此功能链,但实际情况并非如此。
升级到1.0.0.RC1
(该版本添加了此属性)并使用@EnableCircuitBreaker
之后:
{
status: "DOWN",
discovery: {
status: "DOWN",
discoveryClient: {
status: "DOWN",
error: "org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.cloud.client.discovery.DiscoveryClient] is defined"
}
},
diskSpace: {
status: "UP",
free: 358479622144,
threshold: 10485760
},
hystrix: {
status: "UP"
},
configServer: {
status: "DOWN",
error: "org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http: //localhost: 8888/bootstrap/default/master":Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect"
}
}
查看了configprops端点后,我的属性似乎被覆盖了。请注意,父级启用了configClient。
parent: {
configClientProperties: {
prefix: "spring.cloud.config",
properties: {
password: null,
discovery: {
enabled: false,
serviceId: "CONFIGSERVER"
},
name: "bootstrap",
label: "master",
env: "default",
uri: "http://localhost:8888",
enabled: true,
failFast: false,
username: null
}
}
},
configClientProperties: {
prefix: "spring.cloud.config",
properties: {
password: null,
discovery: {
enabled: false,
serviceId: "CONFIGSERVER"
},
name: "bootstrap",
label: "master",
env: "default",
uri: "http://localhost:8888",
enabled: false,
failFast: false,
username: null
}
}
如果我做得不对,请指出方向,将不胜感激。