maven+mybatis+spring mapping下的xml文件没有编译到输出路径
来源:互联网 发布:阿里云网站域名 编辑:程序博客网 时间:2024/06/06 00:52
maven+mybatis+spring在开发的时候,遇到如下错误:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘xxxService’: Unsatisfied dependency expressed through field ‘xxxMapper’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘xxxMapper’ defined in file [xxxMapper.class]: Cannot resolve reference to bean ‘sqlSessionFactory’ while setting bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [xxx-mybatis.xml]: Initialization of bean failed; nested exception is org.springframework. beans.TypeMismatchException: Failed to convert property value of type ‘java.lang.String’ to required type ‘org.springframework.core.io.Resource[]’ for property ‘mapperLocations’; nested exception is java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:com/xxx/xxx/mapping/*.xml]: class path resource [com/xxx/xxx/mapping/] cannot be resolved to URL because it does not exist
经过检查发现maven编译后并没有将xml文件打包到输出路径,导致bean创建失败。
因此解决方法就是在pom文件的build域中添加如下代码:
<build> ... <resources> <!--编译之后包含xml--> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources> ...</build>
- maven+mybatis+spring mapping下的xml文件没有编译到输出路径
- maven项目编译后在classes文件夹下没有编译出mybatis的xml文件的解决方案
- 修改myeclipse下maven项目的文件编译输出路径
- Maven项目编译后classes文件中没有.xml mybatis BindingException
- eclipse中maven项目编译出来,没有mybatis的mapper.xml
- MAVEN 编译spring boot + mybatis 出现 Error parsing Mapper XML.
- 使用Maven对SSM整合时,XML文件没有打包到项目的war文件中
- Eclipse + Maven 3.2.3 编译mybatis项目时漏掉了mapper目录的xml文件
- Maven项目下WEB-INFO目录下没有编译的classes文件
- maven下Struts2+Spring+mybatis+sqserver+c3p0 pom.xml配置
- eclipse Maven项目发布到Tomcat下classes文件夹却没有子模块的编译类
- 归纳下spring+maven+mybatis的使用
- eclipse下编辑mybatis xml文件没有提示解决办法
- log4j.xml文件输出到web工程相对路径的log目录
- mybatis 的mapping报XML Parsing Error
- mybatis--maven默认不会将java下xml文件打包至classpath导致的问题
- maven下 spring+springmvc+mybatis整合,映射文件加载异常
- Maven设置将src/main/java下的xml编译到classpath
- android程序控制系统关机
- 用less写css,用jade写html,用coffeescript写js
- 安装双系统启动时候出现grub rescue
- 配对、绑定、密钥生成方法
- MyBatis简介
- maven+mybatis+spring mapping下的xml文件没有编译到输出路径
- ios学习第一天(二)oc基本数据类型
- 15. CommandLineRunner 启动加载数据
- java 两个变量之间如何交换它们的值
- Colored Balls codeforces
- PHP核心配置详解
- AngularJs实现表单文件的上传
- native opengl
- vim-查/替/插/删/复/粘/选