您好,欢迎来到世旅网。
搜索
您的当前位置:首页idea出现The injection point has the following annotations: - @org.springframework.beans.factory...

idea出现The injection point has the following annotations: - @org.springframework.beans.factory...

来源:世旅网
  •  
  • 出现下方错误请查看启动类:XXXApplication 是否扫描到mapper映射文件,声明eclipse和idea不一样,这里eclipse可以跑通,idea中不行
        ***************************
        APPLICATION FAILED TO START
        ***************************

        Description:

        Field chapterDao in cn.yixue.service.ChapterServiceImp required a bean of type 'cn.yixue.dao.ChapterMapper' that could not be found.

        The injection point has the following annotations:
            - @org.springframework.beans.factory.annotation.Autowired(required=true)


        Action:

        Consider defining a bean of type 'cn.yixue.dao.ChapterMapper' in your configuration.


        以上提取出有用的信息:required a bean of type 'xxxx' that could not be found.
        
        代表bean没注入,从bean注入寻找方向,有的人会说我用@Autowired之类的种种,但没扫到,好吧~

解决方法:

@Mapper
public interface ChapterMapper {
    ......
}
  1. 启动类加@MapperScan(value = "cn.yixue.video.dao") value 后的包一定要对应到mapper类对应的地方,比如我的mapper在dao下,就是cn.yixue.video.dao
@SpringBootApplication
@MapperScan(value = "cn.yixue.video.dao")
@EnableDiscoveryClient
public class YixueVideoApplication {

    public static void main(String[] args) {
        SpringApplication.run(YixueVideoApplication.class, args);
    }

}

以下大佬给我很大的启发,灰常感谢

 

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- esig.cn 版权所有 湘ICP备2023023988号-3

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务