先声明,写到properties配置文件的变量名最好具有特殊性
新建test.properties配置文件,内容如下
com.name=wx5f559450f4170318
一种是使用spring提供的一个标签,可以简单配置,如下
<context:property-placeholder location="classpath:test.properties"/>
配置多个properties通过分号隔开在后面添加即可,例如
<context:property-placeholder location="classpath:test.properties,classpath:jdbc.properties"/>
另一种是通过注到bean的属性来进行配置,这里也是配置多个,如下