在使用SpringBoot装配mybatis时出现了异常

***************************
APPLICATION FAILED TO START
*************************** Description: Field studentService in com.example.demo.action.StudentController required a bean of type 'com.example.demo.service.StudentService' 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.example.demo.service.StudentService' in your configuration. Process finished with exit code 0

查了一下,大意是因为我的StudentService没有被SpringBoot的自动装配扫描到,解决办法就是在SpringBootApplication类上加一行注解指定需要被装配的Service包

Like this:

@ComponentScan(basePackages = {"com.example.demo.service"})
public class SpringBootApplication {

Consider defining a bean of type `xxx` in your configuration问题解决的更多相关文章

  1. springboot 工程启动报错之Consider defining a bean of type ‘XXX’ in your configuration.

    一.前言: 使用springboot自动注入的方式搭建好了工程,结果启动的时候报错了!!!,错误如下图: Description: Field userEntityMapper in com.xxx. ...

  2. 关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案

    搭建完spring boot的demo后自然要实现自动注入来体现spring ioc的便利了,但是我在实施过程中出现了这么一个问题,见下面,这里找到解决办法记录下来,供遇到同样的问题的同僚参考 Des ...

  3. IntelliJ IDEA 2017版 spring-boot 报错Consider defining a bean of type 'xxx' in your configuration问题解决方案

    问题分析: 通过问题的英文可知,这个错误是service的bean注入失败,那么为什么会产生这个问题呢? 主要是框架的Application产生的,所以我们建立项目的时候,要保证项目中的类跟Appli ...

  4. springboot Consider defining a bean of type 'xxx' in your configuration

    这个错误是service的bean注入失败,主要是Application位置不对,要保证项目中的类在Application启动服务器类的下一级目录,如图:

  5. spring boot注入error,Consider defining a bean of type 'xxx' in your configuration问题解决方案

    经常出现这问题一定是非spring生态圈的@标签 没被spring引入,如mybatis等 因为在默认情况下只能扫描与控制器在同一个包下以及其子包下的@Component注解,以及能将指定注解的类自动 ...

  6. Consider defining a bean of type 'package' in your configuration [Spring-Boot]

    https://stackoverflow.com/questions/40384056/consider-defining-a-bean-of-type-package-in-your-config ...

  7. Consider defining a bean of type 'XX.XX.XX.XX.mapper.XXMapper' in your configuration.

    今天构建一个springboot 项目,采用mybatis+mysql 然后就出现了这种错误....浪费我半天时间 Description: Field loginLogMapper in com.g ...

  8. 开发错误日志之No matching bean of type [xxx] found for dependency

    No matching bean of type [org.springframework.data.mongodb.core.MongoTemplate] found for dependency ...

  9. Spring Boot:Consider defining a bean of type '*.*.*' in your configuration解决方案

    果然不看教程直接使用在遇到问题会懵逼,连解决问题都得搜半天还不一定能帮你解决了... ***************************APPLICATION FAILED TO START*** ...

随机推荐

  1. JSP读取properties文件变量

    1.jsp代码 <%ResourceBundle res = ResourceBundle.getBundle("properties文件名"); %> 2.js代码 ...

  2. c# redis密码验证笔记

    参考博客https://www.cnblogs.com/qukaicheng/p/7514168.html写的 安装教程https://www.redis.net.cn/tutorial/3503.h ...

  3. 【原创】大叔问题定位分享(36)openresty(nginx+lua)中获取不到post数据,ngx.req.get_body_data返回nil

    openresty(nginx+lua)中获取不到post数据,ngx.req.get_body_data返回nil This function returns nil if the request ...

  4. Django数据查询中对字段进行排序

    Django数据查询中对字段进行排序   第一种方法:使用order_by进行排序 Articlelist = Article.objects.filter(**kwargs).order_by('n ...

  5. 深入理解hadoop之mapreduce

    本文系原创,若有转载需要,请注明出处.https://www.cnblogs.com/bigdata-stone/ 1.mapReduce简介 MapReduce是面向大数据并行处理的计算模型.框架和 ...

  6. mysql in 中使用子查询,会不使用索引而走全表扫描

    所以可以将 in 条件中 子查询转换成一张子表,从而通过 join 的形式进行条件限制.

  7. interrupt分析

    转载自 https://blog.csdn.net/zhangliangzi/article/details/52485319 interrupt简述 interrupt() 方法只是改变中断状态而已 ...

  8. Jerry眼中的SAP客户数据模型

    本文Jerry将介绍八款SAP产品中的客户模型.希望您在阅读完本文之后,能对SAP客户模型设计的思路有一个最最粗浅的了解. 由于Jerry水平和精力所限,本文不会详细阐述这些产品里的客户模型设计细节, ...

  9. flask开发环境

    1. 创建虚拟环境flask_py3 虚拟环境是一个互相隔离的目录 mkvirtualenv flask_py3 2.安装flask包 pip install flask==0.10.1 其他:导入f ...

  10. linux——在windows上搭建linux练习环境

    程序员自己研究——java-linux-php——环境搭建 需要首选准备一个linux环境. 1,可用安装一个虚拟机:VMware虚拟机 2,安装一个VMware大约5分钟左右. 3,截止目前2019 ...