我有一个弹簧上下文配置。在此配置中,我有以下属性占位符:
<context:property-placeholder location="classpath:my_prop_file.properties,
classpath:my_prop_file-${envTarget}.properties" ignore-resource-not-found="true"/>
这个想法是,所有属性都设置在 my_prop_file.properties 中,而在其他属性文件中我只覆盖一些(my_prop_file-env1.properties、my_prop_file-env2.properties 等)。这工作正常。问题是当我在启动时省略了 vm 参数 -DenvTarget 。有没有办法默认呢?当未设置该值时,我收到:
Could not resolve placeholder 'envTarget' in string value