Reputation: 1693
I want to launch my program with java ... -Denv=prod ...
and have
@PropertySource("classpath:/settings/$idontknowwhat$/database.properties")`
read properties file: /settings/prod/database.properties
I have tried using #{systemProperties['env']}
but it is not resolved with exception:
Could not open ServletContext resource ['classpath:/settings/#{systemProperties['env']}/database.properties]
Upvotes: 14
Views: 17463
Reputation: 1693
Found it, I can simply use
@PropertySource("classpath:/settings/${env}/database.properties")
Upvotes: 24