2

I have externalized properties defined in separate jar. I want to read this in Spring cloud config server and expose this as service to connecting app. These properties would vary depending on environment, again using Profile, one can get relevant properties.

I see there are many ways to do this, using PropertySource One with PropertySourcesPlaceholderConfigurer. Few approaches are using Environment

What are pros and cons between each approach. This might be community question. I see plenty of questions on this area, but there isn't a uniformed, guideline on what approach we need to use for the different scenarios? One of the youtube video talks about having 15 different ways to pick properties. I would like to know more around this area and so that this might be useful for other developers

Cœur
  • 37,241
  • 25
  • 195
  • 267
pramodc84
  • 1,576
  • 2
  • 25
  • 33
  • 1
    Hello, yaml are not supported by propertysource. Only application.properties. Yaml is only supported while in resources folder. See https://stackoverflow.com/questions/21271468/spring-propertysource-using-yaml – Oreste Viron Apr 16 '18 at 11:16
  • 1
    For spring boot you should probably Configuration Properties. https://stackoverflow.com/questions/46055112/is-it-possible-to-get-custom-object-from-spring-application-properties/46055234#46055234 The properies can be injected and passed around, saving you from pain of the value annotation – Darren Forsythe Apr 16 '18 at 11:20

0 Answers0