sprongboot引入quartz报错:Field jobDetails in mysite.cloud.quartz.config.QuartzConfig required a bean of type '[Lorg.quartz.JobDetail;' that could not be found.

作者
2025-06-23阅读 96

1、问题描述

我的代码是:

    @Autowired
    private List<SchedulerFactoryBeanCustomizer> customizers;
    @Autowired
    private JobDetail[] jobDetails;

null

启动的时候报错

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.

null

2、解决方法

引用方式更改private final的方式

    private final QuartzProperties properties;
    private final List<SchedulerFactoryBeanCustomizer> customizers;
    private final JobDetail[] jobDetails;

null



全部评论

头像
乌兔
前端开发
私信
获得点赞 445
文章被阅读 31,261