报错信息:
Description:
Parameter 3 of constructor in org.springblade.modules.visual.controller.VisualController required a bean of type ‘xxxx’ that could not be found.
Action:
Consider defining a bean of type ‘xxx’ in your configuration.
========================================================
将@AllArgsConstructor改为@RequiredArgsConstructor
并把需要构建构造函数的加上final
例如:
@AllArgsConstructor
public class my service {
@Value("${my.config.value}")
private String myField;
private Object myDependency;
...
}
修改为
@RequiredArgsConstructor
@Service
public class MyService {
@Value("${my.config.value}")
private String myField;
private final MyComponent myComponent;
//...
}
参考:
java – Best practice for @Value fields, Lombok, and Constructor Injection? – Stack Overflow
版权声明:本文为aileailex原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。