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 ...
随机推荐
- Cocoapods的简单介绍和使用
1.Cocoapods运行环境和gem命令 1.1 Ruby运行环境和gem命令 Mac自带Ruby环境.如果gem版本太旧,可以使用以下指令升级到最新: sudo gem update --syst ...
- C语言学习--常量指针与指针常量
指针常量 #include<stdio.h> #include<string.h> //常量指针:是一个指针, 定义不用初始化, 能改变指向,但是指向的内容不能被修改 cons ...
- zabbix监控网络断网情况--初级版
zabbix初级监控,通过IMCP方式PING即可 添加网络网关IP地址,鉴于zabbix一般报警方式采取发送邮件.钉钉.微信报警需要网络环境支持,于是至少设置zabbix服务器双网通,建议有条件上三 ...
- 安全漏洞之grafana-cve_2021_43798
漏洞说明 一个可绕过用户登录进行任意文件读取的漏洞 环境搭建 我使用的是vulfocus提供的vulfocus/grafana-cve_2021_43798 ,由vulfocus后台统一管理 利用脚本 ...
- SpringCloud-Hoxton.SR1-config整合
1.前一篇讲到了整合eureka和gateway,实现了服务的发现与注册以及网关的统一入口,这一篇在此基础上整合分布式配置中心config,首先新建一个子项目config-services作为服务端, ...
- GIT 上传文件出错:fatal: Could not read from remote repository. 解决方案
问题 git push -u origin master 执行后报错 fatal: Could not read from remote repository. 解决方案 1. git执行 git ...
- shell脚本操作mysql通用脚本
作用:可以在写监控脚本时,将结果值保存到mysql数据库 使用方法:sh 脚本 库名称.表名称 字段=值 字段=值 字段=值 1.脚本 [root@localhost tmp]# cat writ_ ...
- 运筹学之线性规划 1.X
线性规划 线性规划问题的标准形式可以写成: \[\begin{aligned} &max~z=\pmb{c}^T\pmb{X} \\ &s.t.\{ \begin{aligned} & ...
- Android中操作 SDCard文件
1 import android.content.Context; 2 import android.graphics.Bitmap; 3 import android.graphics.Bitmap ...
- 杭电oj 青年歌手大奖赛_评委会打分
Problem Description 青年歌手大奖赛中,评委会给参赛选手打分.选手得分规则为去掉一个最高分和一个最低分,然后计算平均得分,请编程输出某选手的得分. Input 输入数据有多组,每 ...