Parameter 0 of constructor in xxx required a bean of type ‘java.lang.String‘ that could not be found
@AllArgsConstructor注解与@Value注解会产生冲突
·
问题概述
今天在使用@Value引用配置文件参数时报错
报错代码
报错原因
在使用lombok->@AllArgsConstructor注解与@Value注解会产生冲突,导致@Value注解不可用
解决方案
1)将@AllArgsConstructor注解改为@RequiredArgsConstructor注解
2)将所有的注入都改为final类型
更多推荐
所有评论(0)