【已解决】A component required a bean of type ‘XXService‘ that could not found
一、问题
使用了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相关推荐
- SpringBoot中service注入失败(A component required a bean of type ‘XXService‘ that could not found)...
先写了JUnit,发现启动不了,注释掉有问题的service也不可以.可能是因为spring开始时会加载所有service吧. 按照网友们的说法,一般需要检查: 1.入口类有没有写MapperScan ...
- 解决:A component required a bean of type ‘javax.jms.Queue‘ that could not be found.
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1. 情景描述:只是想简单写个 ActiveMQ 的小样,启动服务却报错: Error starti ...
- 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 ...
- 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 ...
- 【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 ...
- 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 ...
- 调用不同模块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 ...
- 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"类 ...
- 解决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.问题 ************************ ...
最新文章
- matlab实现定标旋转,Matlab摄像机标定工具箱的使用说明精编.doc
- 初识Linux——菜鸟篇
- leetcode(1)---两数之和
- 一个最简单的apache ant hello world例子
- php一句话过狗,整理的最新WebSHell (php過狗一句話,過狗菜刀,2016過狗一句話,2016php免殺一句話)...
- C# FileSystemWatcher 在监控文件夹和文件时的用法
- spring总结(01)
- 在Python中手动引发(抛出)异常
- 并行开发 4.同步机制(上)
- 已知X随机变量的情况下,求解Y=G(x)的概率分布函数(只考虑单调的情况)
- 数据结构题集(C语言版)——第一张 绪论(1~6)
- 视频教程-网站建设-1小时学会建站,采用PHPWAMP搭建网站[全程实战]-PHP
- 数据采集工具:八爪鱼
- java多线程问题(代码示例)
- python中render是什么意思_Django中render_to_response和render的区别(转载)
- DELL G7 重装win10系统
- CAS单点登录(SSO)介绍及部署
- 第一次ACM校赛_记录
- SPICE仿真软件基础
- FPGA ——I2C总线 原理详解
热门文章
- meso-四(4-N十六胺基磺酰苯基)四苯并卟啉啉(THASPTBP)及其铁(THASPTBPFe)、钴(THASPTBPCo)、镍(THASPTBPNi)、锌(THASPTBPZn)配合-科研试剂
- 微信小程序—拖拽排序
- 香港第一金:美债美元强势打压黄金狂泻近30美元
- ESP32反复重启报rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT) flash read err, 1000错误
- 关于SoftMax函数的一些介绍
- 四子星服务器装系统,天津超微四子星服务器报价
- Ae:合成查看器 - 3D 视图选项
- 华为低版本手机无法正常安装软件(失败原因:验证失败)解决办法
- Bootstrap框架菜鸟入门教程
- 如何入坑新媒体运营,有哪些工具可以用?