1、问题描述
我的代码是:
@Autowired
private List<SchedulerFactoryBeanCustomizer> customizers;
@Autowired
private JobDetail[] jobDetails;
启动的时候报错
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2025-06-17 17:30:48.133 ERROR --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field jobDetails in mysite.cloud.quartz.config.QuartzConfig required a bean of type '[Lorg.quartz.JobDetail;' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type '[Lorg.quartz.JobDetail;' in your configuration.
2、解决方法
引用方式更改private final的方式
private final QuartzProperties properties;
private final List<SchedulerFactoryBeanCustomizer> customizers;
private final JobDetail[] jobDetails;