标签导入多个文件


先上错误代码

#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" />

参考链接:https://my.oschina.net/u/2326864/blog/1619107


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM