[size=large]如applicationContext-hessian-client.xml中需要application.properties资源文件中的配置
资源文件内容:
hessian.server=192.168.1.100
(1)先在xml文件中加入配置:[/size]
[size=large]
(2) 若xml中需要application.properties,那么用${key}的形式进行配置[/size]
[size=large]通过如上两步,可实现spring中xml配置文件与properties资源文件的集成。[/size]
资源文件内容:
hessian.server=192.168.1.100
(1)先在xml文件中加入配置:[/size]
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<!-- 配置资源文件的位置 -->
<value>classpath*:/application.properties</value>
</list>
</property>
</bean>
[size=large]
(2) 若xml中需要application.properties,那么用${key}的形式进行配置[/size]
<property name="serviceUrl"
value="http://${hessian.server}/dmp-caucho/LogHessian">
</property>
[size=large]通过如上两步,可实现spring中xml配置文件与properties资源文件的集成。[/size]