需要一个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. 个人常用的win7快捷键

    1.Win + D – 显示桌面 2.Win+L    锁定系统 3.Win + R – 打开运行窗口 4.Win+M     最小化所有窗口      当按下后当前所有窗口全都最小化.再次按下这个组 ...

  2. C# snaps

    C# 启用 禁用 本地连接 1 static void Enable(string interfaceName) 2 { 3 System.Diagnostics.ProcessStartInfo p ...

  3. 有关箭头函数的this知识

    总结: 结果: 2,箭头函数正确的使用方法. 结果: 总结: 箭头函数不要直接在对象的属性上用.比如上面的函数3.

  4. idea设置类,方法模板 阿里检测

    一.设置IDEA 中的类注释模板File -> Settings -> Editor -> File and Code Templates -> Files /** * @Cl ...

  5. Java-【大数处理】和【日期类】

    [大数类] BigInteger(整数) 和 BigDecimal(小数) 都是Java针对大数提供的类 常用方法: (1)加:add (2)减:subtract (3)乘:multiply (4)除 ...

  6. C# 调用https接口 安全证书问题 解决方法

    原文链接: https://blog.csdn.net/lizaijinsheng/article/details/127321758 说明: 如果是用https的话,由于没有证书,会报错:基础连接已 ...

  7. NIO基本编写

    一.编写server端 1 public class Server implements Runnable{ 2 //1 多路复用器(管理所有的通道) 3 private Selector selet ...

  8. curl下载远程图片到服务器

    <?php //curl下载远程图片到服务器 方法 function download($url, $path = 'images/'){ $ch = curl_init(); $names = ...

  9. 【JavaScript】JS写法随笔(一) Ajax写法

    $("#btn").click(function () { var wanted_code = $("#wanted_code").children('opti ...

  10. html页面下载为docx文档

    1.安装要用到的两个插件:html-docx-js-typescript.file-saver. 2.导入两个方法: import { asBlob } from 'html-docx-js-type ...