A compent required a bean of type ‘java.lang.String‘ that could not found
Posted 蜜桃婷婷酱
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A compent required a bean of type ‘java.lang.String‘ that could not found相关的知识,希望对你有一定的参考价值。
项目启动报错:A compent required a bean of type ‘java.lang.String’ that could not found
springboot应用启动的时候,bean的加载扫描失败,错误信息如下A component required a bean of type ‘XXX’ that could not be found.
开发中遇到这种问题,这是一个很大的坑,
本项目是一个SpringBoot项目,项目中用到了@Resource注解,但是@Resource下面并没有任何变量和方法,就会引发这个问题
解决:在@Resource下面加入变量或者删除@Resource,反正不要让它空着就行
以上是关于A compent required a bean of type ‘java.lang.String‘ that could not found的主要内容,如果未能解决你的问题,请参考以下文章
当出现类似这种required a single bean, but 2 were found的spring注入bean错误分析
A component required a bean named ‘XXXService‘ ...
SpringBoot项目启动出现required a bean of type 'XXX' that could not be found
A component required a bean named 'cacheManager' that could not be found.