1

It is possible to consume the values of the properties file being served using Spring Config server.

Here's my current implementation to consume the values inside a file

Parameters params = new Parameters();
        FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<PropertiesConfiguration>(
                PropertiesConfiguration.class).configure(params.fileBased().setFile(new File("client-config.properties")));
        PropertiesConfiguration config = builder.getConfiguration();

        // Perform interpolation on all variables
        PropertiesConfiguration extConfig =
            (PropertiesConfiguration) config.interpolatedConfiguration();

So I was wondering if can use this kind of implementation but instead of getting a file, it retrieves the values from the Spring Config Server

Francis Zabala
  • 1,037
  • 2
  • 11
  • 30
  • If you mean spring cloud config then check this http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html – Arun Nov 08 '16 at 23:11
  • @Arun I can't find in the docs referencing spring cloud config – Francis Zabala Nov 09 '16 at 06:40
  • http://stackoverflow.com/questions/37974776/spring-boot-load-multiple-yaml-files -- Here, in this question I have the code and application.yml is in spring cloud config. The spring docs link mentioned above also addresses the same, you keep the content you want to read from in your config file (applcation.yml or application.properties and write a class to read it. – Arun Nov 09 '16 at 17:09

0 Answers0