一、问题

使用了Mybatis generator自动生成的bean和mapper
写完service层和controller层后运行报错A component required a bean of type 'XXService' that could not found

二、解决方式

在springBoot主入口函数Application里添加注释@MapperScan("com.SF.data.dao")
括号里为自己的mapper路径

@SpringBootApplication
@MapperScan("com.SF.data.dao")
public class Shoppingweb01Application {public static void main(String[] args) {SpringApplication.run(Shoppingweb01Application.class, args);}}

三、产生原因

mapper文件位置和service文件位置不是父子层关系(同级)导致扫描时没有将sercive注入

四、一些试错

使用过@ComponentScan来进行包扫描、运行时确实不会报错了但数据出不来
可能是springboot在容器里找到了此组件但不知道交给谁去做解析

【已解决】A component required a bean of type ‘XXService‘ that could not found相关推荐

  1. SpringBoot中service注入失败(A component required a bean of type ‘XXService‘ that could not found)...

    先写了JUnit,发现启动不了,注释掉有问题的service也不可以.可能是因为spring开始时会加载所有service吧. 按照网友们的说法,一般需要检查: 1.入口类有没有写MapperScan ...

  2. 解决:A component required a bean of type ‘javax.jms.Queue‘ that could not be found.

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1. 情景描述:只是想简单写个 ActiveMQ 的小样,启动服务却报错: Error starti ...

  3. A component required a bean of type ‘XXX‘ that could not be found 解决办法

    springboot应用启动的时候,bean的加载扫描失败,错误信息如下A component required a bean of type 'XXX' that could not be foun ...

  4. A component required a bean of type ‘com.lw.mapper.StudentMapper‘ that could not be found.

    当我们用springboot整合mybatis时,发生以下错误 Description:A component required a bean of type 'com.lw.mapper.Stude ...

  5. 【A component required a bean of type ‘‘ that could not be found】

    A component required a bean of type 'cn.gson.oasys.model.dao.managework.mappers.MwDetailsMapper' tha ...

  6. SpringBoot中service注入失败 出现A component required a bean of type 'com.czxy.changgou3.mapper.OrderGoodsMa

    错误信息 Error starting ApplicationContext. To display the conditions report re-run your application wit ...

  7. 调用不同模块A component required a bean of type ‘com.qhzx.td.service.OtcPurchaseSellOutManageService‘ that

    springboot应用启动的时候,bean的加载扫描失败,错误信息如下A component required a bean of type 'XXX' that could not be foun ...

  8. A component required a bean of type ‘com.wyh.service.XXX‘ that could not be found.

    A component required a bean of type 'XXXService' that could not be found 组件需要找不到"Service"类 ...

  9. 解决A component required a bean named ‘entityManagerFactory‘ that could not be found

    SpringBoot 整合 Spring Data JPA 报警 1.问题 2.三步走 2.1检查依赖 2.2删除依赖 2.3检查DB配置类 1.问题 ************************ ...

最新文章

  1. matlab实现定标旋转,Matlab摄像机标定工具箱的使用说明精编.doc
  2. 初识Linux——菜鸟篇
  3. leetcode(1)---两数之和
  4. 一个最简单的apache ant hello world例子
  5. php一句话过狗,整理的最新WebSHell (php過狗一句話,過狗菜刀,2016過狗一句話,2016php免殺一句話)...
  6. C# FileSystemWatcher 在监控文件夹和文件时的用法
  7. spring总结(01)
  8. 在Python中手动引发(抛出)异常
  9. 并行开发 4.同步机制(上)
  10. 已知X随机变量的情况下,求解Y=G(x)的概率分布函数(只考虑单调的情况)
  11. 数据结构题集(C语言版)——第一张 绪论(1~6)
  12. 视频教程-网站建设-1小时学会建站,采用PHPWAMP搭建网站[全程实战]-PHP
  13. 数据采集工具:八爪鱼
  14. java多线程问题(代码示例)
  15. python中render是什么意思_Django中render_to_response和render的区别(转载)
  16. DELL G7 重装win10系统
  17. CAS单点登录(SSO)介绍及部署
  18. 第一次ACM校赛_记录
  19. SPICE仿真软件基础
  20. FPGA ——I2C总线 原理详解

热门文章

  1. meso-四(4-N十六胺基磺酰苯基)四苯并卟啉啉(THASPTBP)及其铁(THASPTBPFe)、钴(THASPTBPCo)、镍(THASPTBPNi)、锌(THASPTBPZn)配合-科研试剂
  2. 微信小程序—拖拽排序
  3. 香港第一金:美债美元强势打压黄金狂泻近30美元
  4. ESP32反复重启报rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT) flash read err, 1000错误
  5. 关于SoftMax函数的一些介绍
  6. 四子星服务器装系统,天津超微四子星服务器报价
  7. Ae:合成查看器 - 3D 视图选项
  8. 华为低版本手机无法正常安装软件(失败原因:验证失败)解决办法
  9. Bootstrap框架菜鸟入门教程
  10. 如何入坑新媒体运营,有哪些工具可以用?