Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot disable Spring Cloud Config via spring.cloud.config.enabled:false

Tags:

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

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.

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.

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

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.

like image 756
bvulaj Avatar asked Dec 19 '14 15:12

bvulaj


People also ask

Which of the following is required to enable the cloud config server?

Creating Spring Cloud Configuration Server Gradle users can add the below dependency in your build. gradle file. Now, add the @EnableConfigServer annotation in your main Spring Boot application class file. The @EnableConfigServer annotation makes your Spring Boot application act as a Configuration Server.

What is the use of spring cloud config failFast true property for the Microservices?

failFast=true , and then you need to add spring-retry and spring-boot-starter-aop to your classpath. The default behaviour is to retry 6 times with an initial backoff interval of 1000ms and an exponential multiplier of 1.1 for subsequent backoffs. You can configure these properties (and others) using spring. cloud.


1 Answers

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).

like image 200
Dave Syer Avatar answered Sep 23 '22 06:09

Dave Syer