SpringMVC配置文件位置
原创
©著作权归作者所有:来自51CTO博客作者pyzheng的原创作品,请联系作者获取转载授权,否则将追究法律责任
[size=large][color=red]在工程内:[/color][/size]
<context:property-placeholder location="classpath:/site.properties"/>
[size=large][color=red]在工程外:[/color][/size]
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<!-- <property name="location"> <value>classpath:ecis.properties</value> </property> -->
<property name="locations">
<list>
<value>file:${PANDY_WEB_APP_HOME}/config/site.properties</value>
</list>
</property>
<property name="systemPropertiesMode">
<value>1</value>
</property>
<property name="searchSystemEnvironment">
<value>true</value>
</property>
<property name="ignoreUnresolvablePlaceholders">
<value>true</value>
</property>
</bean>
其中:${PANDY_WEB_APP_HOME}是VM Options里面配置的:
[color=darkblue]-DPANDY_WEB_APP_HOME="/mnt/D/pand_web_app_config"[/color]
[size=large][color=red]使用:[/color][/size]
<bean id="dataSource" class="${jdbc.dataSource}" destroy-method="close">
<property name="driverClassName" value="${jdbc.driver}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<!-- <property name="alias" value="${proxool.alias}" />
<property name="houseKeepingTestSql" value="${proxool.houseKeepingTestSql}" />
<property name="prototypeCount" value="${proxool.prototypeCount}" />
<property name="minimumConnectionCount" value="${proxool.minimumConnectionCount}" />
<property name="maximumActiveTime" value="3600000" /> -->
</bean>