我想用java ... -Denv=prod ...
启动我的程序
@PropertySource("classpath:/settings/$idontknowwhat$/database.properties")`
读取属性文件:/settings/prod/database.properties
我已尝试使用#{systemProperties['env']}
,但未解决异常:
Could not open ServletContext resource ['classpath:/settings/#{systemProperties['env']}/database.properties]
答案 0 :(得分:12)
找到它,我可以简单地使用
@PropertySource("classpath:/settings/${env}/database.properties")