先上錯誤代碼
#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" />