SpringMVC + mybatis 无法读取JAR包中的XML配置文件问题
来源:互联网 发布:遗传算法 旅行商问题 编辑:程序博客网 时间:2024/05/03 22:31
SpringMVC + mybatis 无法读取JAR包中的XML配置文件问题
在进行SpringMVC+Mybatis进行整合时,如果Mybatis的XML配置文件存在于JAR包中,当工程运行时会报出找不到方法异常。
如:
<bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="datasource"></property>
<property name="mapperLocations">
<array>
<value>classpath:com/sdzn/*/dao/xml/*.xml</value>
</array>
</property>
</bean>
虽然正常情况下是可以读取XML配置文件的,但如果将工程打成JAR包,发布出去,在新工程中进行引用时,就会出现找不到XML配置文件的情况
因此我们需要将配置文件做一个修改
<bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="datasource"></property>
<property name="mapperLocations">
<array>
<value>classpath*:com/sdzn/*/dao/xml/*.xml</value>
</array>
</property>
</bean>
即在classpath后面加一个*号。意义是读取JAR中的XML文件
- SpringMVC + mybatis 无法读取JAR包中的XML配置文件问题
- SpringMVC + mybatis 无法读取JAR包中的XML配置文件问题
- 读取Jar包中的配置文件
- spring+springmvc+mybatis中的xml配置文件详解
- JAR包中读取配置文件问题
- JAR包中读取配置文件问题
- springmvc+mybatis jar包
- 打成jar包的xml配置文件无法找到路径,System.getProperty("user.dir")解决该问题
- 读取jar中的配置文件
- Spring+Mybatis整合读取Jar中的mapper配置文件
- 读取Jar包中的资源问题探究
- 读取Jar包中的资源问题探究
- 读取Jar包中的资源问题探究
- 读取Jar包中的资源问题探究
- java读取jar包配置文件
- ssm spring+springmvc+mybatis中的xml配置文件详解
- SSM:spring+springmvc+mybatis框架中的XML配置文件功能
- springmvc配置文件:spring-mybatis.xml
- 使用vue时Module build failed: TypeError: this._init is not a function错误的解决方法
- 分享一个textView右上角的添加小红点的 tips
- 【u217】土地划分
- jdk8新特性 lambda表达式详解
- 如何给table加滚动条
- SpringMVC + mybatis 无法读取JAR包中的XML配置文件问题
- python 环境搭建(一) virtualenv 的简单使用
- MVC模式:
- 古话云:家中放三物,财运大门为你打开,家人从此大富!
- ServletContext接口是servlet中最大的一个接口
- ireport 生成二维码
- CentOs7虚拟机与防火墙
- Codeforces Round #382 (Div. 2) C. Tennis Championship(斐波那契递推)
- xfce 快捷键 命令整理