今天用最新的

<groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.1.2.RELEASE</version>
<dependency>   <groupId>com.baomidou</groupId>   <artifactId>mybatis-plus-boot-starter</artifactId>   <version>3.0.7.1</version></dependency>

提示找不到Mapper曾的bean,Mapper中使用@Repository
解决方案:方案1 在启动类中添加 @MapperScan("xxx.xxx.xxx.mapper")方案2 @Repository换成@Mapper

:: Spring Boot :: (v2.1.2.RELEASE)

2019-01-24 16:17:53.735 INFO 13800 --- [ main] c.d.v.VwtaterMybatisplusApplication : Starting VwtaterMybatisplusApplication on LAPTOP-F72VHEUV with PID 13800 (C:\workspace\test\vwtater-mybatisplus\target\classes started by vwater in C:\workspace\test\vwtater-mybatisplus)
2019-01-24 16:17:53.742 INFO 13800 --- [ main] c.d.v.VwtaterMybatisplusApplication : No active profile set, falling back to default profiles: default
2019-01-24 16:17:54.783 WARN 13800 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.djtu.vwtater]' package. Please check your configuration.
2019-01-24 16:17:55.640 INFO 13800 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-01-24 16:17:55.665 INFO 13800 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-01-24 16:17:55.665 INFO 13800 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.14]
2019-01-24 16:17:55.672 INFO 13800 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\software\java\jdk\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Python27\;C:\Python27\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\software\java\jdk\bin;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\software\Git\cmd;C:\software\apache-maven-3.5.4\bin\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\software\tortoiseSVN\bin;C:\software\python;C:\WINDOWS\System32\OpenSSH\;C:\Users\vwater\Downloads\apache-jmeter-5.0\\bin;C:\Program Files\Amazon\AWSCLI\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\software\python\Scripts\;C:\software\python\;C:\Users\vwater\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;;.]
2019-01-24 16:17:55.818 INFO 13800 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-01-24 16:17:55.818 INFO 13800 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1992 ms
2019-01-24 16:17:55.910 WARN 13800 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeController': Unsatisfied dependency expressed through field 'employeeMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.djtu.vwtater.mapper.EmployeeMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2019-01-24 16:17:55.915 INFO 13800 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-01-24 16:17:55.949 INFO 13800 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-01-24 16:17:56.068 ERROR 13800 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

***************************
APPLICATION FAILED TO START
***************************

Description:

Field employeeMapper in com.djtu.vwtater.controller.EmployeeController required a bean of type 'com.djtu.vwtater.mapper.EmployeeMapper' that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'com.djtu.vwtater.mapper.EmployeeMapper' in your configuration.

Disconnected from the target VM, address: '127.0.0.1:52242', transport: 'socket'

Process finished with exit code 1

转载于:https://www.cnblogs.com/vwater/p/10315217.html

@Mapper和@Repository的问题相关推荐

  1. @Mapper和@Repository的区别

    1.相同点 @Mapper和@Repository都是作用在dao层接口,使得其生成代理对象bean,交给spring 容器管理,对于mybatis来说,都可以不用写mapper.xml文件 2.不同 ...

  2. spring boot 中@Mapper和@Repository的区别

    一:前言 @Mapper和@Repository是常用的两个注解,两者都是用在dao上,两者功能差不多,容易混淆,有必要清楚其细微区别: 二:区别 @Repository需要在Spring中配置扫描地 ...

  3. 【详细清晰】@Mapper和@Repository的使用和区别

    先讲解这两个注解是啥意思,它们之间的区别和联系. ①    @Mapper是MyBatis的注解,@Repository是Spring中的注解,这些注解就是声明一个Bean. ②    @Mapper ...

  4. 解决springboot不扫描@repository的问题

    问题:单独使用@repository注解注dao层,而且不使用@mapperscan扫描时,启动项目会报错: Field xxxxMapper in com.sms.shiro.service.imp ...

  5. 在springBoot中使用Mapper类问题_@Mapper_@MapperScan_xml文件跟mapper分开_xml文件跟mapper在同一个目录下

    文章目录 背景 xml文件跟mapper分开 application.properties 方式一: 主程序中@MapperScan 方式二: 每个接口添加@Mapper 注意点 xml文件跟mapp ...

  6. Field XXXService in com.XXX.controller.XXX required a bean of type ‘com.XXX.mapper.xxx‘that could no

    解决办法: Field surveyTypeService in com.XXX.controller.XXX required a bean of type 'com.XXX.mapper.xxx' ...

  7. SpringBoot整合Shiro安全框架完整实现

    目录 一.环境搭建 1. 导入shiro-spring依赖 2. 编写首页及其controller 3. 编写shiro配置类 二.Shiro实现登录拦截 1. 编写页面及其controller 2. ...

  8. 快速上手MyBatisPlus~(基友搭配,效率翻倍)

    目录 一.简介 二.快速入门 1. 创建数据库及数据表 2. 新建项目,导入依赖 3. 编写数据库配置文件&连接 4. 创建pojo实体类 5. 编写mapper&扫描 6. 测试类简 ...

  9. SpringBoot整合MyBatis详细教程~

    目录 1. 导入依赖 2. 连接数据库 3. 编写数据库配置信息 4. 编写pojo实体类 5. 编写mapper接口 6. 编写mapper.xml 7. 编写controller 8. 测试 1. ...

最新文章

  1. 【一步步学小程序】2.列表展示
  2. 双链表的创建,求长,插入,删除,打印,释放(循环和非循环)
  3. Windows下nginx-http-flv-module服务部署
  4. 计算机广告制作未来发展还行吗,计算机多媒体设计专业和广告设计制作那个好...
  5. NOIP模拟测试15「建造城市city(插板法)·轰炸·石头剪刀布」
  6. 4个mos管驱动的全桥电路原理_逆变电源中的三种保护电路讲解
  7. Linux alias设置别名 Ubuntu设置别名创建简写指令短命令
  8. Epoll 的time_out参数引发的cpu占用问题
  9. 《信息安全系统设计基础》实验五 简单嵌入式WEB服务器实验
  10. Cronbach’s α?KMO系数?因子载荷?史上最易懂的问卷信效度分析教程!!!(SPSS和AMOS)
  11. Java Web day14
  12. 互联网新半场的流量生态——阿里云定向免流方案
  13. Oracle:经典例题解析
  14. python怎么读?如何正确的发音?
  15. 中心极限与大数定理律的关系_CLT 中心极限定理
  16. io.reactivex.exceptions.UndeliverableException
  17. 【系统分析师之路】系统分析师必知必会(需求分析篇)
  18. 首先,你要自信| 万工随笔
  19. VMware 连接ISO镜像时,切换可移动设备时遇到错误: 对磁盘“ide1:0”执行的连接控制操作失败?
  20. 计算机简史:从分布式到中心化的博弈螺旋

热门文章

  1. Linux命令能否运行在Windows上?
  2. 算法高级(46)-波士顿动力机器人ATLAS
  3. JDK命令之java -- 用来执行字节码文件,即用来执行Java程序
  4. iOS 新浪微博分享授权失败的问题
  5. 鸿蒙OS尝鲜, 居然还有这种事情!
  6. 用laravel 搭一套AI chatgpt 写作助手和内容创作 saas 系统
  7. java泛型中的通配符是_理解在Java泛型中使用通配符?
  8. 广东理工学院计算机考试大纲,广东理工学院2020年专插本《思维与设计》考试大纲...
  9. Bootstrap关闭弹出窗导致另一个弹出窗滚动条消失的解决办法
  10. 一级行星齿轮减速器的结构设计 NGW行星减速器的设计【说明书(毕业论文)+8张CAD图纸】