spring applicationContext.xml配置
2016-05-06 09:25
519 查看
当applicationContext.xml,item-servlet.xml,jdbc.properties是放在WEB-INF目录下时,配置如下即可 【
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>WEB-INF/jdbc.properties</value>
</list>
</property>
</bean>
当放在src目录下时 配置需要如下编写【<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:source/jdbc/jdbc.properties</value>
</list>
</property>
</bean>】
如果 放在src下配置写成<value>source/jdbc/jdbc.properties</value>则会报如下错误:
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is Java.io.FileNotFoundException:
Could not open ServletContext resource [/source/jdbc/jdbc.properties]
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>WEB-INF/jdbc.properties</value>
</list>
</property>
</bean>
当放在src目录下时 配置需要如下编写【<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:source/jdbc/jdbc.properties</value>
</list>
</property>
</bean>】
如果 放在src下配置写成<value>source/jdbc/jdbc.properties</value>则会报如下错误:
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is Java.io.FileNotFoundException:
Could not open ServletContext resource [/source/jdbc/jdbc.properties]
相关文章推荐
- 微信开发,access_token,时间上没有过期,但已失效的问题
- 《Motion Design for iOS》(十二)
- Objective-C的缓存框架EGOCache在iOS App开发中的使用
- Android 屏幕适配方案
- 解决Android studio导入项目gradle location is incorrect问题
- iOS数据持久化
- iOS动态性runtime初探(改私有变量,私有方法)
- 多线程-wait(针对OBJECT对象锁的方式)
- swift之给拓展Category增加属性
- iOS ---- KVO的内部实现原理
- android 开机动画和关机动画修改与制作
- iOS tabelView获取当前选中cell
- Android Studio 2问题故障合集
- Android 简单实现ListView顶部悬浮效果
- Android Studio 快捷键总结
- asp 提示 没有权限: 'CreateObject'
- iOS开发简单高效的数据存储
- Swift中类的使用
- Android Fragment 真正的完全解析(下)
- IOS 集合视图指南2:集合视图基础