问答详情
源自:3-6 dao层开发

测试一直不通过

为什么我一直出现注入dao错误

提问者:慕粉3511415 2018-02-06 17:16

个回答

  • weibo_幕布斯0340456
    2020-04-03 17:33:07

    报错,什么原因

  • weibo_幕布斯0340456
    2020-04-03 17:32:45

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.miniprogram.miniproj.dao.AreaDaoTest': Unsatisfied dependency expressed through field 'areaDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.miniprogram.miniproj.dao.AreaDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


  • root750
    2018-02-07 20:42:13

    哎呀 找到了 DataSourceConfiguration mapperScan弄错了 你重新写 你的dao在哪个包下就去扫哪个

  • 翔仔
    2018-02-06 17:48:15

    同学好,指的是@Autowired标签报错吗,如果是请降低idea的报警等级,这是idea spring facet的一个bug视频里会有说明 

    解决方案如下

    使用IDEA工具时使用@Resource和@Autowired自动注解bean时会显示红色,但是项目能运行 
    解决方法: 
    File – Settings – Inspections。在Spring Core – Autowring for Bean Class 中将Severity的级别由之前的error改成warning。