在Spring - applicationContext.xml配置文件中读取properties配置文件的内容可以使用org.springframework.beans.factory.config.PropertyPlaceholderConfigurer类。
我们写一个
properties文件中每个强制换行为一个变量声明与赋值:
varName=varValue
在引用此文件的文件中使用:
${varName}即可以得到varValue;
我们写一个
<bean name="customName"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
p:location="/WEB-INF/classes/*fileName.properties">
properties文件中每个强制换行为一个变量声明与赋值:
varName=varValue
在引用此文件的文件中使用:
${varName}即可以得到varValue;