在使用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. StoneTab标签页CAD插件 3.2.3

    //////////////////////////////////////////////////////////////////////////////////////////////////// ...

  2. Django rest-framework框架-版本控制

    第一版: from rest_framework.versioning import BaseVersioning class ParamVersion(object): def determine_ ...

  3. docker第一篇 容器技术入门

    Container 容器是一种基础工具,泛指任何可以容纳其它物品的工具. Linux Namespaces (docker容器技术主要是通过6个隔离技术来实现) namespace    系统调用参数 ...

  4. 5.Servlet 对象(request-response)

    /*ServletResponse*/ /*responese常见应用*/ 1.向客户端输出中文数据 (分别以OutputStream 和 PrintWriter输出) 2.文件下载和中文文件的下载 ...

  5. 【转】Delphi货币类型转中文大写金额

    unit TU2.Helper.Currency; interface ): string; ): string; implementation uses System.SysUtils, Syste ...

  6. c# MVC方式文件上传

    MVC控制器中代码 index.cshtml <form action="/Home/Upload" method="post" enctype=&quo ...

  7. Java攻城狮面试题录:笔试篇(1)

    1.作用域public,private,protected,以及不写时的区别答:区别如下:不写时默认为friendly 2.ArrayList和Vector的区别,HashMap和Hashtable的 ...

  8. 【Day4】1.JsonPath使用案例

    import json python_data = [ { 'username': 'normal', 'vip': True, }, { 'username':None, 'vip':False } ...

  9. C语言创建线程以及使用锁进行读写分离

    线程的使用 1.线程的创建 线程的相关操作放在<pthread.h>中. 1.1我们定义一个线程,首先要进行定义一个函数,类似我们创建一个a线程 void *thread_a(void * ...

  10. ConcurrentDictionary源码概读

    ConcurrentDictionary的数据结构主要由Tables和Node组成,其中Tables包括桶(Node,节点)数组.局部锁(Local lock).每个锁保护的元素数量(PerLock) ...