SpringBoot中required a bean of type ‘java.lang.String‘ that could not be found问题

编程入门 行业动态 更新时间:2024-10-24 21:24:15

SpringBoot中required a <a href=https://www.elefans.com/category/jswz/34/1763836.html style=bean of type ‘java.lang.String‘ that could not be found问题"/>

SpringBoot中required a bean of type ‘java.lang.String‘ that could not be found问题

项目场景:

Parameter 3 of constructor in cn.xxx  required a bean of type 'java.lang.String' that could not be found


问题描述:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-11-10 11:24:32.661   {faint}  ERROR 21720 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : ***************************
APPLICATION FAILED TO START
***************************Description:Parameter 1 of constructor in cn.xxx required a bean of type 'java.lang.String' that could not be found.Action:Consider defining a bean of type 'java.lang.String' in your configuration.Process finished with exit code 1

原因分析:

@AllArgsConstructor 与 @Value 不能同时用


解决方案:

把  @AllArgsConstructor  换成  @RequiredArgsConstructor


作者:筱白爱学习!!

欢迎关注转发评论点赞沟通,您的支持是筱白的动力!

更多推荐

SpringBoot中required a bean of type ‘java.lang.String‘ that could not be found问题

本文发布于:2023-11-15 07:58:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1596311.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:bean   required   SpringBoot   type   String

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!