Consider defining a bean of type `xxx` in your configuration问题解决
2024-09-04 02:25:46
在使用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 {
最新文章
- Python爬取代理ip
- Windows 8 下离线安装。net Framework 3.5
- JQuery学习之Ajax应用
- ubuntu 图形界面查看隐藏文件
- Net开发环境配置
- xmodem, ymodem &; zmodem
- head tail 命令
- lucene分词多种方法
- # void :;
- VMware Workstation 11安装
- [AH/HNOI2017]大佬
- Microsoft Store应用安装路径和应用推荐——如何用Linux命令操控windows
- 常用VIM插件配置
- k64 datasheet学习笔记3---Chip Configuration之Times
- GitHub上README.md教程 详情介绍 (修改图片连接地址错误)
- kettle(一) 安装全过程
- JAVA Iterator 转成 List
- 应用程序添加角标和tabBar添加角标,以及后台运行时显示
- modelsim仿真中Altera库的用法
- MongoDB安装笔记