Field userService in com.lin.hms.controller.LogController required a bean of type 'org.lin.hms.service.UserService' that could not be found.
需要一个bean但找不到

解决
我们在controller使用的service没有注入spring容器,那么我们可以在启动类上,加上包扫描注解,让这个bean所在的包能扫描到:
@ComponentScan(basePackages = {"org.lin.hms.service"})

Field userService in com.lin.hms.controller.LogController required a bean of type 'org.lin.hms.service.UserService' that could not be found.的更多相关文章
- Spring Cloud Ribbon负载均衡配置类放在Spring boot主类同级增加Exclude过滤后报Field config in com.cloud.web.controller.RibbonConfiguration required a bean of type 'com.netflix.client.config.IClientConfig' that could not b
环境: Spring Cloud:Finchley.M8 Spring Boot:2.0.0.RELEASE 目录结构: 可以看到代码第13行的注释,我已经在@ComponentScan注解中添加了E ...
- Field userService in com.wuji.controller.UserController required a bean of type 'com.wuji.service.UserService' that could not be found
Field userService in com.wuji.controller.UserController required a bean of type 'com.wuji.service.Us ...
- 解决办法 Field userService in com.sxsj.controller.RegistLoginController required a bean of type
转自:https://blog.csdn.net/awmw74520/article/details/82687288 APPLICATION FAILED TO START Error starti ...
- SpringCloud报错: "Field discoveryClient in com.controller.DcController required a bean of type 'com.netflix.discovery.DiscoveryClient' that could not be found."
SpringCloud报错: "Field discoveryClient in com.controller.DcController required a bean of type 'c ...
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.oskyhang.gbd.service.UserService] found for dependency: expected at least 1 bean which qualifies as aut
spring中一个符号的错误居然让我浪费了四五个小时才找出来,不得不给自己了两个耳光.. 由于新建项目与原来项目的目录结构有所不同,copy过来的配置文件,有些地方修改的不彻底,导致spring扫描注 ...
- 2. springboot启动报错:Field userMapper in com.service.UserService required a bean of type 'com.dao.UserMapper' that could not be found.
报错信息: 2018-06-25 14:26:17.103 WARN 49752 --- [ restartedMain] ationConfigEmbeddedWebApplicationCon ...
- springboot jpa mongodb 整合mysql Field in required a bean of type that could not be found Failed to load ApplicationContext
1.完整报错 *************************** APPLICATION FAILED TO START *************************** Descripti ...
- 运行springboot项目报错:Field userMapper in XX required a bean of type 'xx' that could not be found.
运行springboot项目报错: *************************** APPLICATION FAILED TO START ************************** ...
- Field redisTemplate in xxxxxx required a bean of type 'org.springframework.data.redis.core.RedisTemplate' that could not be found.
*************************** APPLICATION FAILED TO START *************************** Description: Fie ...
- How to solve the error "Field service in com.xx.xxx.xxxx required a bean of type 'com.aa.bb.cc' that could not be found."
When runung a SpringBoot demo, I got a error as following: *************************** APPLICATION ...
随机推荐
- go语言web框架-如何使用gin教程+react实现web项目
go-web+ react实践项目 前端使用react 搭建,从webpack搭建开始写,后端是学习go语言过程中的实践,由于之前没有实际的后端web经验,所以是自己一点一点摸索出来的.有错漏还望指正 ...
- constexpr和const
const表示一个变量的值不能改变,这个值可以使运行期间得到的const int sz = get_size(); constexpr是提示编译器,该值可以在编译期间就计算出来,并进行替换,不用等到运 ...
- 使用layui时遇到的问题以及解决文章链接
1.斜线表头效果 2.表格嵌套使用 3.layui数据表格跨行自动合并 4.layui表格数据变更的处理方式 5.layer弹窗动态添加KindEditor编辑器 6.layer弹出层自动调节位置 7 ...
- window批处理一键打开多个exe
使用批处理的start命令,格式为start /d "绝对路径" 目标exe名,记得路径和exe名间有个空格 @echo off start /d "E:\demo\&q ...
- 每一行输出5个字符之后换行 js
方法1 使用正则 (如果是汉字,此正则,每五个字换行,如果是英文字符,每十个英文,换行) let arrX ="这是个测试字符串,这是个测试字符串" arrX = arrX.re ...
- Hook新特性(一)
基础Hook 1.useState const [state, setState] = useState(initialState); //返回一个state变量,指为initialState,set ...
- MySQL dump 备份脚本
vim db_all.sh #!/bin/sh logFile=/home/shell/db_backup.log DATE=`date +'%Y%m%d_%H_%M'` cd /home/data ...
- 每日一抄 Go语言使用select切换协程
看了两篇博客,一个说:在任何一个 case 中执行 break 或者 return,select 就结束了. 另一个说:break只能跳出select中的一个case 验证了一下,不知道对不对,感觉是 ...
- jenkins中的pipline
Jenkins Pipeline 的核心概念 Pipeline,简而言之,就是一套运行于Jenkins上的工作流框架,将原本独立运行于单个或者多个节点的任务连接起来,实现单个任务难以完成的复杂流程编排 ...
- 学习lua-03,集合排序,集合插入元素
array = {"Google", "Runoob"} table.insert(array,1,"hello world!") for ...