需要一个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. Mongodb设置账号密码登录

    Mongodb设置.首先设置Data目类和Log目录,然后新建mongodb.conf,设置内容大体如下 port = 27017 #数据目录 dbpath = /usr/softs/data/db ...

  2. 部分jdk网盘链接

    链接:https://pan.baidu.com/s/1Nw84qVRL3Buarh2LY1lWEg 提取码:6q2z 含 6u45 7u80 8u202 11.0.X 的win及linux版 没有网 ...

  3. CxImageJPG

    typedef struct tag_ExifInfo { char Version [5]; //EXIF 信息版本 char CameraMake [32]; //DC 制造商 char Came ...

  4. 【快速学】C/C++编译器

    编译器 谁维护 平台 版权 Visual C++ Microsoft https://visualstudio.microsoft.com/ Microsoft Windows 有免费版 GCC C ...

  5. drf从入门到飞升仙界 07

    认证组件 ## 认证组件逻辑 # 1.登录认证的限制: - 访问接口,有的需要登陆后才能访问,有的接口,不登录就能访问 # 2.准备: -User表 : 存储用户名,密码 -UserToken表:存储 ...

  6. git版本回退:git reset --hard 版本号

    开发项目中会遇到各种奇葩的事情: 奇葩系列之在项目更新迭代开发正带劲的时候突然更新项目之前的项目出问题了要修复.在开发功能一半又要修复之前的问题着急上线的情况下.此时此刻git的版本回退是那么的迷人, ...

  7. (linux笔记)开放防火墙端口

    关闭防火墙 CentOS 7.RedHat 7 之前的 Linux 发行版防火墙开启和关闭( iptables ): 即时生效,重启失效 #开启 service iptables start #关闭 ...

  8. oracle内存管理

    关于内存管理 必须管理的内存结构是系统全局区(SGA)和实例程序全局区(instance PGA).Oracle 数据库支持各种内存管理方法,这些方法由初始化参数设置选择. 自动内存管理 Oracle ...

  9. FFmpeg 摄像头采集

    FFmpeg 摄像头采集 extern "C" { #include "libavcodec/avcodec.h" #include "libavfo ...

  10. java 类对象四种方法加载方式

    public static void main(String[] args) throws Exception { //第一种 //这里需要做异常处理,或的加载类的类对象类. Class<?&g ...