Consider defining a bean of type `xxx` in your configuration问题解决
在使用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问题解决的更多相关文章
- springboot 工程启动报错之Consider defining a bean of type ‘XXX’ in your configuration.
一.前言: 使用springboot自动注入的方式搭建好了工程,结果启动的时候报错了!!!,错误如下图: Description: Field userEntityMapper in com.xxx. ...
- 关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案
搭建完spring boot的demo后自然要实现自动注入来体现spring ioc的便利了,但是我在实施过程中出现了这么一个问题,见下面,这里找到解决办法记录下来,供遇到同样的问题的同僚参考 Des ...
- IntelliJ IDEA 2017版 spring-boot 报错Consider defining a bean of type 'xxx' in your configuration问题解决方案
问题分析: 通过问题的英文可知,这个错误是service的bean注入失败,那么为什么会产生这个问题呢? 主要是框架的Application产生的,所以我们建立项目的时候,要保证项目中的类跟Appli ...
- springboot Consider defining a bean of type 'xxx' in your configuration
这个错误是service的bean注入失败,主要是Application位置不对,要保证项目中的类在Application启动服务器类的下一级目录,如图:
- spring boot注入error,Consider defining a bean of type 'xxx' in your configuration问题解决方案
经常出现这问题一定是非spring生态圈的@标签 没被spring引入,如mybatis等 因为在默认情况下只能扫描与控制器在同一个包下以及其子包下的@Component注解,以及能将指定注解的类自动 ...
- 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 ...
- Consider defining a bean of type 'XX.XX.XX.XX.mapper.XXMapper' in your configuration.
今天构建一个springboot 项目,采用mybatis+mysql 然后就出现了这种错误....浪费我半天时间 Description: Field loginLogMapper in com.g ...
- 开发错误日志之No matching bean of type [xxx] found for dependency
No matching bean of type [org.springframework.data.mongodb.core.MongoTemplate] found for dependency ...
- Spring Boot:Consider defining a bean of type '*.*.*' in your configuration解决方案
果然不看教程直接使用在遇到问题会懵逼,连解决问题都得搜半天还不一定能帮你解决了... ***************************APPLICATION FAILED TO START*** ...
随机推荐
- IOC+EF+Core项目搭建IOC注入及框架(二)
配置ServiceCollection /// <summary> /// 表示IServiceCollection的扩展 /// </summary> public stat ...
- H5的本地存储(localStorage)和cookie比较
HTML5 的 web Storage 存储方式有两种:localStorage 和 sessionStorage. sessionStorage就像是会话级别的cookie,数据会随着浏览器关闭而清 ...
- vue-cli之加载ico文件
vue-cli之加载ico文件 vue-cli加载ico文件需要在vue.config.js设置ico加载,代码如下: module.exports = { publicPath: process.e ...
- 微信小程序配置动态title
wx.setNavigationBarTitle({ title: this.dynTitle }) 通过页面路由跳转传参 onload(opt)中的opt接受传过来的title 赋值即可
- Nginx如何配置禁止访问某个目录
location ~* \.(txt|doc)${ root /data/www/wwwroot/test; deny all; }
- MySQL cmd操作
1.开启关闭服务 net start mysql net stio mysql 2.登陆 在CMD命令窗口敲入命令 mysql -hlocalhost -uroot -p 后按回车(注意这里的&quo ...
- Linux 虚拟机扩容
由于在装软件,原来的20G空间不够使用,需要扩容操作. 1.关闭虚拟机 2.点击编辑虚拟机设置 选中硬盘,添加,硬盘,推荐,确定大小,完成. 2.启动虚拟机 查看磁盘使用情况: [root@maste ...
- 10_Redis_多数据库
一:概念: 一个Redis实例可以包括多个数据库,客户端可以指定连接某个redis实例的哪个数据库,就好比一个mysql中创建多个数据库,客户端连接时指定连接哪个数据库. 一个Redis实例最多可提供 ...
- bug是前端还是后端
分析bug是前端还是后端的 如何分析一个bug是前端还是后端的? 平常提bug的时候,前端开发和后端开发总是扯皮,不承认是对方的bug这种情况很容易判断,先抓包看请求报文,对着接口文档,看请求报文 ...
- poj2942 Knights of the Round Table[点双+二分图染色]
首先转化条件,把无仇恨的人连边,然后转化成了求有哪些点不在任何一个奇环中. 一个奇环肯定是一个点双,所以想到处理出所有点双,但是也可能有的点双是一个偶环,有的可能是偶环和奇环混杂,不好判. 考察奇环性 ...