Skip to content
Advertisement

EnableConfigServer is not working for native location in spring boot

I am trying to configure a configuration server for all the properties in our application using @EnableConfigServer in spring boot. Please see the code below :

JavaScript

pom.xml

JavaScript

application.properties

JavaScript

Copied all the property files to : /Users/Sankest/StarterProjects/MicroServices/AllConfigurations/

But when I try to access url at http://localhost:9090/config-server/default I am not seeing any property files and getting the following response:

JavaScript

Advertisement

Answer

  1. Correct value should be spring.cloud.config.server.native.searchLocations=file:///Users/Sankest/StarterProjects/MicroServices/AllConfigurations/ with 3 front slashes after file:. One way to verify whether path is correct or not, even without running the application, is to paste the path in browser and check whether it shows all the files.
  2. For default profile make sure either file name is application.yml or application.properties.
  3. For other profiles e.g. dev, file name should be application-dev.yml or application-dev.properties (if all are in the same folder), then http://localhost:9090/config-server/dev would show both dev and default profile entries.
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement