I think I've read all I could find on the topic, but cannot get the @PropertySource annotation to read an environment variable.
This works fine:
@PropertySource("file:C:\Code\java\myappname\configuration\myappname_config.properties")
But I do need to read the path from environment, so I have the myappname_path environment variable set up (I'm on Windows, with SpringBoot 1.5.4)
Either of those gets me "Could not resolve placeholder" exception:
@PropertySource("file:${myappname_path}\myappname_config.properties") @PropertySource("file:${systemProperties['myappname_path']}\myappname_config.properties")
Thank you very much for help.
UPDATE: OK, that was my fault. Apparently, in this case the reboot was necessary to get the system property to take effect. So now this syntax works: @PropertySource("file:${myappname_path}\myappname_config.properties")
This one does not, but it's not that important: @PropertySource("file:${systemProperties['myappname_path']}\myappname_config.properties")
Thanks a lot for responses.