required a bean of type ‘java.lang.String‘ that could not be found

  • Post author:
  • Post category:java




项目场景:


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.
2021-05-05 15:00:32.661   {faint}  ERROR 21720 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 3 of constructor in cn.orderHandler 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

解决方式具体可以参看以下说法


https://www.it610.com/article/1275266064153853952.htm



版权声明:本文为qq_36856047原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。