报错如下:

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的更多相关文章

  1. spring+mybatis项目启动报错Initializing Spring root WebApplicationContext

    这个问题很怪异,各种各样的情况都会导致这个问题的出现,主要是由于sping加载读取配置文件的时候出了问题.我在处理mybatis的时候出现了这个问题,后来排查发现,在mybatis的配置文件中如果有大 ...

  2. 用 Eclipse 搭建一个简单的 Maven spring mybatis 项目(包含测试用例)

    1: 先搭建一个Maven项目: 创建好后的目录: 2: 配置pom.xml文件: <project xmlns="http://maven.apache.org/POM/4.0.0& ...

  3. ssm项目框架搭建(增删改查案例实现)——(SpringMVC+Spring+mybatis项目整合)

    Spring 常用注解 内容 一.基本概念 1. Spring 2. SpringMVC 3. MyBatis 二.开发环境搭建 1. 创建 maven 项目 2. SSM整合 2.1 项目结构图 2 ...

  4. 创建spring boot项目启动报错遇到的问题

    1.Spring boot,Mybatis 启动报错 Failed to auto-configure a DataSource *************************** APPLICA ...

  5. 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 ...

  6. spring boot项目启动报错

    在eclipse中运行没有任何问题,项目挪到idea之后就报错 Unable to start EmbeddedWebApplicationContext due to miss EmbeddedSe ...

  7. 详细解释 集成Maven Spring Mybatis项目包生成Bat文件

    有时在项目必须Maven项目包生成bat文件,长官一人.本文将解释的具体使用方法maven-assembly-plugin插件实现bat文件包. 1.首先看一下项目结构 2.配置pom.xml文件,在 ...

  8. spring+mybatis项目整合

    前辈总结的很详细,贴出链接,参考学习 http://www.open-open.com/lib/view/open1392252233301.html

  9. 【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 ...

随机推荐

  1. 个人成长|荣获CNVD年度最有价值漏洞奖

    本文共750+字,预计阅读2-3分钟. 前几天,很荣幸受主办方邀请,还拿了CNVD的一个“年度最有价值漏洞奖”,说一说,这几天的故事吧. 11月20号,意外收到一个会议邀请,当时还比较诧异,印象中我在 ...

  2. Linux应急响应(一):SSH暴力破解

    0x00 前言 ​ SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议,主要用于给远程登录会话数据进行加密,保证数据传输的安全.SSH口令长度太短或者复杂度不够,如仅包含数字,或仅包 ...

  3. WopiServerTutorial

    Program.cs using System; using System.Collections.Generic; using System.IO; using System.Linq; using ...

  4. [C/E] 等差数列求和

    题目:要求给定一个整数 N,求从 0 到 N 之间所有整数相加之和. 解1:使用 for 循环依次递加. #include <stdio.h> int main(void){ int x; ...

  5. mybais 之parameterType ="list"

    <!-- 根据货品编号获取商品价格和库存 --> <select id="getGoodsPriceAndStockByGoodsNo" resultMap=&q ...

  6. 在MyEclipse(2015)中上传项目到github的步骤(很详细)

    (图文)在MyEclipse(2015)中上传项目到github的步骤(很详细) git|smartGit使用详解 SmartGit使用教程

  7. Android Studio Error:Connection timed out: connect.解决方案

    遇到了这样的错误: Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the ...

  8. Visual C++中去除警告

    在编程中,编译器警告的意思是提问程序员:如果这样做将会出现意外的错误,你确定要这样做吗? 在很多情况下,我们写程序的时候会出现一些警告,而这些警告我们都知道这样做的确是需要的并且程序中多处出现这种做法 ...

  9. 百度地图API接口

    js <script type="text/javascript"> // 百度地图API功能 var map = new BMap.Map("map&quo ...

  10. 【JSON.NET】json序列化小驼峰格式(属性名首字母小写)

    废话少说,先上代码 var setting = new JsonSerializerSettings { ContractResolver = new Newtonsoft.Json.Serializ ...