[英]set properties by vm-option in tomcat (local)
我有一些问题。
在格式化之前我的 intellij 工作得很好。 我为多个环境管理一些值,并通过一些属性文件进行控制。
这是一些示例。 我有一些这样的属性文件。
production.properties
test.properties
test-remote.properties
而我的 tomcat 配置(当然是 VM 选项)设置如下。 ... -Drun.mode=test...
这是我的root-context.xml
。
...
<!-- Root Context: defines shared resources visible to all other web components -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:${run.mode}.properties</value>
</list>
</property>
</bean>
...
正如我所说,在格式化之前,如果更改 tomcat 的 vmoption -Drun.mode=SOMETHING,则可以。 但格式化后,只有工作test
属性。
你们有什么想法吗? 我什至无法想象我该如何解决它。
非常有趣的一点是。 测试运行良好。 但是仅使用test.properties
并没有硬编码。
与tomcat的版本不同。
通常我使用 8.5.x 格式后我使用 9.0.x 并且有一些 ClassNotFound 异常。
更改为使用 tomcat 8.5.x 后问题消失了。
但是必须通过VM选项弄清楚为什么9.0.x没有运行属性文件select。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.