无法通过spring.cloud.config.enabled禁用Spring Cloud Config:false [英] Cannot disable Spring Cloud Config via spring.cloud.config.enabled:false

查看:1208
本文介绍了无法通过spring.cloud.config.enabled禁用Spring Cloud Config:false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我不是直接使用Spring Cloud Config,而是通过Spring Cloud Hystrix启动程序传递.

Let me preface this by saying that I'm not using Spring Cloud Config directly, it is transitive via Spring Cloud Hystrix starter.

仅使用@EnableHystrix时,Spring Cloud也会尝试查找配置服务器,但由于我未使用配置服务器,因此预期不会成功.据我所知,该应用程序运行正常,但问题出在状态检查中.运行状况显示DOWN,因为没有配置服务器.

When only using @EnableHystrix, Spring Cloud also tries to locate a configuration server, expectedly unsuccessfully, since I'm not using one. The application works just fine, as far as I can tell, but the problem is in the status checks. Health shows DOWN because there is no config server.

浏览项目源代码,我希望spring.cloud.config.enabled=false禁用此功能链,但这不是我所看到的.

Browsing the source of the project, I'd expect spring.cloud.config.enabled=false to disable this functionality chain, however this is not what I'm seeing.

升级到1.0.0.RC1(添加此属性)并使用@EnableCircuitBreaker后:

After upgrading to 1.0.0.RC1 (which adds this property) and using @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.

After checking the configprops endpoint, it seems that my properties are being overridden. Note that the parent has the configClient enabled.

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
    }
}

如果似乎我没有正确执行此操作,则可以接受任何指导.

Any direction would be appreciated, if it seems I'm not doing this correctly.

推荐答案

引导过程中需要配置服务器,而这正是父属性来源.看来您需要做的就是将您的spring.cloud.config.enabled属性移动到bootstrap.yml(或.properties).

The config server is needed during bootstrap, and that's where the parent property sources come from. It looks like all you need to do is move your spring.cloud.config.enabled property to bootstrap.yml (or .properties).

这篇关于无法通过spring.cloud.config.enabled禁用Spring Cloud Config:false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆