[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">标签:WEB,配置文件,SpringMVC,APP,位置,color,HOME,red,size From: https://blog.51cto.com/u_3871599/6142198
<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>