【发布时间】:2015-02-18 13:46:05
【问题描述】:
让我先说我没有直接使用 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
}
}
如果我似乎没有正确执行此操作,任何方向都将不胜感激。
【问题讨论】:
-
你用的是什么版本的Spring Cloud?
-
我使用的是 1.0.0.M3 的 spring-cloud-starter-parent,它引入了相同版本的 spring-cloud-starter-hystrix。我也用这些信息更新了我的问题,谢谢。
-
试试 RC1(刚刚发布)。我认为该标志是最近添加(或扩展)的。
-
谢谢,@DaveSyer - 我会试一试并报告。
-
@DaveSyer - 我已将我的发现添加到原始帖子而不是 cmets。我不确定这种变化对我来说是好是坏。我还注意到一些可能会覆盖我的配置的父属性。
标签: spring spring-boot netflix spring-cloud hystrix