先上错误代码
#MyBatis.xml
<context:property-placeholder location="classpath:jdbc.properties" />
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
</bean>
#redis.xml
<context:property-placeholder location="classpath:redis.properties" />
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
</bean>
spring mvc整合redis时新增了一个redis.xml配置文件,该配置文件中使用<context:property-placeholderlocation>
读取properties文件,结果发现不行,一直读取不到。
原来是因为<context:property-placeholderlocation>
标签只能在spring配置文件中存在一份,改为如下解决:
<context:property-placeholder location="classpath:jdbc.properties, classpath:redis.properties" />