springboot中Injection of resource dependencies failed

04-19 阅读 0评论

问题一:无非就是注解的问题,业务实现类加@Service,映射类加@Mapper、启动类上加上@MapperScan(basePackages = "xxx.xxx")以及@Resouce和@Autowired的使用(IDEA中最好使用@Resouce,倒不是说@Autowired有错,但是会报波浪线或者爆红,虽然不影响运行),这类问题没什么好说的,自己看一下漏什么补什么。

springboot中Injection of resource dependencies failed,springboot中Injection of resource dependencies failed,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,使用,错误,影响,第1张
(图片来源网络,侵删)

问题二:

 @Resource
 XXXMapper xMapper;
 @Resource
 YYYMapper xMapper;
 或者
 @Autowired
 XXXMapper xMapper;
 @Autowired
 YYYMapper xMapper;

名字起相同了,无论是引入service还是mapper,都不要把别名起一样,这样也会报这样的错误

问题三:由于springboot的版本,有些依赖于springboot版本不搭配,也会报错,比如mybatis-plus,mybatis暂时没发现有什么问题。解决办法就是降低springboot的版本咯,是3.x.x的降低到2.x.x,重启就好了。

问题三:依赖包引入错误的,无论是web的还是resouce注解等的依赖包,最好看清楚再引入,例如:

import jakarta.annotation.Resource;(错误的)
   和
import javax.annotation.Resource;(正确的)

两个相差不大,将这些玩意删除重新引入就可以了................................

问题四:application.yml或者application.properties中的:

springboot中Injection of resource dependencies failed,springboot中Injection of resource dependencies failed,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,使用,错误,影响,第2张
(图片来源网络,侵删)
配置mybatis或者mybatis-plus
mybatis:
  mapper-locations: classpath:mapper/*.xml(需检查处)
  type-aliases-package: com.jiayi.quanyi.pojo(需检查处)
  configuration:
    map-underscore-to-camel-case: true 
或
mybatis-plus:
  mapper-locations: classpath:/mapper/*.xml(需检查处)
  configuration:
    log-impl: xxxx.xxxxx  (需检查处)
    call-setters-on-nulls: true 

看一下路径是否填错之类的,需要与自己项目目录路径完全一致即可。

.................................................................

其他的应该也没什么大问题了,还有什么问题的可以评论区说一下

springboot中Injection of resource dependencies failed,springboot中Injection of resource dependencies failed,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,使用,错误,影响,第3张
(图片来源网络,侵删)

免责声明
本网站所收集的部分公开资料来源于AI生成和互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复: 表情:
评论列表 (暂无评论,人围观)

还没有评论,来说两句吧...

目录[+]