idea 创建的maven+spring+mybatis项目整合 报错无法创建bean
报错如下:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public com.wolf.dao.IUserDao com.wolf.service.impl.IUserServiceImpl.udao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.wolf.dao.IUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IUserDao' defined in file [G:\maven_project\demo\ssm\target\classes\com\wolf\dao\IUserDao.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 [spring-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/wolf/mapper/*.xml]: class path resource [com/wolf/mapper/] cannot be resolved to URL because it does not exist
一直是不能创建bean的样子,经过检查发现mybatis的映射xml文件居然没有找到,发现classes目录果然没有*.xml,在pom文件中加入了如下代码,问题成功解决。
<build> <resources>
<!--编译之后包含xml-->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources> </build>
idea 创建的maven+spring+mybatis项目整合 报错无法创建bean的更多相关文章
- spring+mybatis项目启动报错Initializing Spring root WebApplicationContext
这个问题很怪异,各种各样的情况都会导致这个问题的出现,主要是由于sping加载读取配置文件的时候出了问题.我在处理mybatis的时候出现了这个问题,后来排查发现,在mybatis的配置文件中如果有大 ...
- 用 Eclipse 搭建一个简单的 Maven spring mybatis 项目(包含测试用例)
1: 先搭建一个Maven项目: 创建好后的目录: 2: 配置pom.xml文件: <project xmlns="http://maven.apache.org/POM/4.0.0& ...
- ssm项目框架搭建(增删改查案例实现)——(SpringMVC+Spring+mybatis项目整合)
Spring 常用注解 内容 一.基本概念 1. Spring 2. SpringMVC 3. MyBatis 二.开发环境搭建 1. 创建 maven 项目 2. SSM整合 2.1 项目结构图 2 ...
- 创建spring boot项目启动报错遇到的问题
1.Spring boot,Mybatis 启动报错 Failed to auto-configure a DataSource *************************** APPLICA ...
- mybatis项目启动报错 The content of element type "resultMap" must match "(constructor?,id*,result*,association*,collection*,discriminator?)".
启动项目报错 2018-02-26 17:09:51,535 ERROR [org.springframework.web.context.ContextLoader] - Context initi ...
- spring boot项目启动报错
在eclipse中运行没有任何问题,项目挪到idea之后就报错 Unable to start EmbeddedWebApplicationContext due to miss EmbeddedSe ...
- 详细解释 集成Maven Spring Mybatis项目包生成Bat文件
有时在项目必须Maven项目包生成bat文件,长官一人.本文将解释的具体使用方法maven-assembly-plugin插件实现bat文件包. 1.首先看一下项目结构 2.配置pom.xml文件,在 ...
- spring+mybatis项目整合
前辈总结的很详细,贴出链接,参考学习 http://www.open-open.com/lib/view/open1392252233301.html
- 【maven】maven的web项目打包报错:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK
打包过程中报错如下: No compiler is provided in this environment. Perhaps you are running on a JRE rather than ...
随机推荐
- Memcached 数据导出与导入
我们使用 memcached-tool 命令来导出数据: [root@localhost ~]# memcached-tool dump > /tmp/.txt Dumping memcache ...
- 如何在 Ubuntu 中安装 Node.js
在终端中执行以下命令: sudo apt-get install python-software-properties python g++ make sudo add-apt-repository ...
- [Ubuntu] APT - Advanced Packaging Tool 简明指南
Advanced Packaging Tool,一般简称为apt,是Debian GNU/Linux distribution及其变体版本中与核心库一道处理软件的安装和卸载. Ubuntu是Debia ...
- 使用CreateProcess创建新的process 并返回process运行结束返回值
转自:http://blog.csdn.net/zgl7903/article/details/5975284 转载这篇主要是记住:获得create的新进程运行结束时的返回值的方法 如下: #in ...
- 模型提升方法adaBoost
他通过改变训练样本的权重,学习多个分类器,并将这些分类器进行线性组合,提高分类的性能. adaboost提高那些被前一轮弱分类器错误分类样本的权重,而降低那些被正确分类样本的权重,这样使得,那些没有得 ...
- 深入理解 Neutron -- OpenStack 网络实现(2):VLAN 模式
问题导读 1.br-int.br-ethx的作用是什么?2.安全组策略是如何实现的?3.VLAN 模式与GRE模式有哪些不同点?流量上有哪些不同?4.L3 agent实现了什么功能? 接上篇深入理解 ...
- 【Spring Boot&&Spring Cloud系列】提高数据库访问性能
前言 使用关系型数据库的应用系统的性能瓶颈最终还是数据库.随着业务的迅速增长,数据量会不断增大,会逐渐暴露关系型数据库的弱点,性能会大幅度的降低 项目地址:https://github.com/And ...
- bootstrap 中这段代码 使bundles 失败
_:-ms-fullscreen, :root input[type="date"], _:-ms-fullscreen, :root input[type="time& ...
- 字符串处理总结之一(C#String类)
C#(静态String类) C#中提供了比较全面的字符串处理方法,很多函数都进行了封装为我们的编程工作提供了很大的便利.System.String是最常用的字符串操作类,可以帮助开发者完成绝大部分的字 ...
- C# IEqualityComparer 去重
1.去除list里某重复字段值的数据(相当于group by) public class CorrController { //方法 public void DoGet() { List<tes ...