Spring systemProperties没有正确附加值

时间:2013-06-06 11:19:05

标签: spring spring-mvc

我使用Spring 3.1在下面的Web应用程序中创建一个bean,其中服务器包含-DCONFIG_MODE = dev。但是,看起来spring只是将文件名解析为configuration.dev而不附加剩余的.xml。你能否指出这可能是错误的。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:ws="http://jax-ws.dev.java.net/spring/core"
   xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                       http://jax-ws.dev.java.net/spring/core http://jax-ws.dev.java.net/spring/core.xsd
                       http://jax-ws.dev.java.net/spring/servlet http://jax-ws.dev.java.net/spring/servlet.xsd">

   <bean id="xmlConfig" class="org.quwic.itms.mq.XmlConfiguration" init-method="init">
       <constructor-arg type="java.net.URL" value="classpath:configuration.#{systemProperties.CONFIG_MODE}.xml"/>
       <constructor-arg type="org.apache.commons.configuration.reloading.ReloadingStrategy" ref="reloadingStrategy"/>
  </bean>

    <!-- The managed reloading strategy for the configuration bean -->
    <bean id="reloadingStrategy" class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy">
        <property name="refreshDelay" value="300000"/>
    </bean>
</beans>

谢谢,

1 个答案:

答案 0 :(得分:0)

修正了它。我错误地将系统属性指定为“-DCONFIG_MODE = local -Dprogram.name = JBossTools:JBoss 5.0 Runtime”而不是-DCONFIG_MODE = local“-Dprogram.name = JBossTools:JBoss 5.0 Runtime”