在我的 Spring 文件中:
<bean id="propertyConfigurer" class="org.myapp.MyConfigurator">
<property name="locations">
<list>
<value>classpath:configuration-${env}.properties</value>
</list>
</property>
</bean>
${env} 变量在 maven 的配置文件中定义。 但是当我从 eclipse 运行 tomcat 6(已发布)中的应用程序时,它不会在 maven 中查找。那么如何为 Tomcat 设置变量呢?
谢谢
随机化
最佳答案
在 Eclipse 中添加系统变量:Go to Run --> Run Configurations --> Tomcat
选择 Arguments 选项卡并添加到 VM arguments -Denv=blabla
关于java - Tomcat + Spring 和环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7904112/