bvu*_*laj 9 spring netflix spring-boot hystrix spring-cloud
让我先说明我没有直接使用Spring Cloud Config,它可以通过Spring Cloud Hystrix入门传递.
仅使用时@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"
}
}
Run Code Online (Sandbox Code Playgroud)
检查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
}
}
Run Code Online (Sandbox Code Playgroud)
任何方向都会受到赞赏,如果看起来我没有正确地做到这一点.
Dav*_*yer 18
引导期间需要配置服务器,这是父属性源的来源.看起来你需要做的就是将你的spring.cloud.config.enabled
属性移动到bootstrap.yml(或.properties).
Mig*_*yol 11
我遇到了同样的问题,我想禁用配置服务器(因为到目前为止我们不需要它),但至少RC1上面提到的属性是不正确的.
spring.cloud.enabled
Run Code Online (Sandbox Code Playgroud)
应该:
spring.cloud.config.enabled
Run Code Online (Sandbox Code Playgroud)
spring.cloud.config.enabled=false
.要么SPRING_CLOUD_CONFIG_ENABLED=false
OR如果将参数传递给SpringApplication.run,则可以通过向应用程序添加参数来禁用配置服务器客户端:
public static void main(String[] args) throws Exception {
SpringApplication.run(YourApplication.class, args);
}
并启动应用程序:
java -jar yourapplication.jar --spring.cloud.config.enabled=false
小智 6
我尝试了上述所有更改,但仍然配置客户端从未停止过。
我能够通过在我的项目的 pom.xml 文件中使用以下排除来禁用它的唯一方法。
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</exclusion>
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
22246 次 |
最近记录: |