需要一个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.的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 解决办法 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 ...

  4. 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 ...

  5. 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扫描注 ...

  6. 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 ...

  7. 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 ...

  8. 运行springboot项目报错:Field userMapper in XX required a bean of type 'xx' that could not be found.

    运行springboot项目报错: *************************** APPLICATION FAILED TO START ************************** ...

  9. 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 ...

  10. 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 ...

随机推荐

  1. Cocoapods的简单介绍和使用

    1.Cocoapods运行环境和gem命令 1.1 Ruby运行环境和gem命令 Mac自带Ruby环境.如果gem版本太旧,可以使用以下指令升级到最新: sudo gem update --syst ...

  2. C语言学习--常量指针与指针常量

    指针常量 #include<stdio.h> #include<string.h> //常量指针:是一个指针, 定义不用初始化, 能改变指向,但是指向的内容不能被修改 cons ...

  3. zabbix监控网络断网情况--初级版

    zabbix初级监控,通过IMCP方式PING即可 添加网络网关IP地址,鉴于zabbix一般报警方式采取发送邮件.钉钉.微信报警需要网络环境支持,于是至少设置zabbix服务器双网通,建议有条件上三 ...

  4. 安全漏洞之grafana-cve_2021_43798

    漏洞说明 一个可绕过用户登录进行任意文件读取的漏洞 环境搭建 我使用的是vulfocus提供的vulfocus/grafana-cve_2021_43798 ,由vulfocus后台统一管理 利用脚本 ...

  5. SpringCloud-Hoxton.SR1-config整合

    1.前一篇讲到了整合eureka和gateway,实现了服务的发现与注册以及网关的统一入口,这一篇在此基础上整合分布式配置中心config,首先新建一个子项目config-services作为服务端, ...

  6. GIT 上传文件出错:fatal: Could not read from remote repository. 解决方案

    问题 git push -u origin master 执行后报错 fatal: Could not read from remote repository.  解决方案 1. git执行 git ...

  7. shell脚本操作mysql通用脚本

    作用:可以在写监控脚本时,将结果值保存到mysql数据库 使用方法:sh 脚本  库名称.表名称 字段=值 字段=值 字段=值 1.脚本 [root@localhost tmp]# cat writ_ ...

  8. 运筹学之线性规划 1.X

    线性规划 线性规划问题的标准形式可以写成: \[\begin{aligned} &max~z=\pmb{c}^T\pmb{X} \\ &s.t.\{ \begin{aligned} & ...

  9. Android中操作 SDCard文件

    1 import android.content.Context; 2 import android.graphics.Bitmap; 3 import android.graphics.Bitmap ...

  10. 杭电oj 青年歌手大奖赛_评委会打分

    Problem Description 青年歌手大奖赛中,评委会给参赛选手打分.选手得分规则为去掉一个最高分和一个最低分,然后计算平均得分,请编程输出某选手的得分.   Input 输入数据有多组,每 ...