Search code examples
springspring-cloudspring-cloud-config

In Spring Cloud, does micro-services read their configurations from Eureka or it only reads from config server?


I am following this video to learn micro-services.

My questions is: Can micro-services read configuration from config service through Eureka, or they can only read configurations directly from config server ?

I am trying to configure and make a client read its configuration from eureka but with no success.


Solution

  • You can use the following option in your bootstrap.yml

    spring.cloud.config.discovery.enabled=true
    

    And you also need to specify the the service id of your config service.

    spring.cloud.config.discovery.serviceId=xxxx
    

    serviceId is usually the the application name.

    If you do like above, your microservivces will try to find the address of config server via discovery service.

    You can find more details here.