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*** ...
随机推荐
- 如何演讲-摘录自TED
一.首先,只传递一个主要思想 想法是个很复杂的东西,你要对你的内容做减法,突出重点,只关注一个主要思想,也就是你最富有热情的观点,利用机会好好的阐述它.你要给出案例,分享案例,生动阐述所以,找到一个 ...
- WindowsAPI操作串口
#include <windows.h> #include <stdio.h> int main() { //1.打开串口 HANDLE hCom; hCom = Create ...
- python numpy 删除array指定位置的元素
如图:设计一个数组或者tuple,其中的元素是True或False,那么在False位置上的元素就会被删掉 索引的元素还可以是int型的数,这时候就代表,将原来的数组中指定位置的数放在当前的位置,且索 ...
- PS常识及技巧
常用格式 JPG:压缩 PNG:透明 GIF:动图 PSD:分层 分辨率 UI选择像素,印刷选择厘米 UI设计:72px 印刷分辨率必须为300 颜色模式UI网页设计:RGB 印刷类设计 ...
- JAVA语言程序设计课后习题----第七单元解析(仅供参考)
1 本题水题,就是想让你理解继承的含义 public class Animaal { public double weight; public void eat(){ } } public class ...
- FTP用户验证、访问设置以及log日志
若要访问FTP站点开启了基本身份认证,访问服务器(ftp://服务器IP:端口号),需要输入正确的用户名及密码才可正常访问 当客户端通过浏览器访问时就需要验证,提示如下图: 1.当输入正确的用户名及密 ...
- 手动编译用于i.MX6系列ARM的交叉编译SDK
前言: 在前一节中,在使用别的机器(系统:UBUNTU14.04)上编译好的交叉编译SDK,配置在我的电脑(系统:UBUNTU16.04)上,用于bazel编译Tensorflow时会报arm-pok ...
- Linux入门基础
计算机及运维介绍 如何学习Linux 要想学好任何一门学问,不仅要眼睛看,耳朵听,还要动手记,勤思考,多交流甚至尝试着去教会别人 1.1 运维核心职责 网站数据不能丢 网站7*24小时运行 提升用户体 ...
- 关于pycharm database查看db.sqlites文件提示:Driver class 'org.sqlite.JDBC' not found
系统重新安装后,启动pycharm存在各种问题,其中一个问题就是在Pycharm中的database里面不能查看sqlite数据库了: 经过一番查找终于找到了问题: 首先问题 是提示这样一个报错: 解 ...
- MYSQL安全模式SQL语法需要注意的地方
MYSQL安全模式 Mysql版本: 背景: 为了避免在执行delete.update将全表数据清空或者覆盖修改,在新项目营销云中开启了mysql的安全模式. 安全模式要求不能对非主键的条件查询做up ...