diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d72eba4c..66d9f125 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -5,7 +5,6 @@ on: branches: - main - develop - - fix/#82-fix-mission-status jobs: build-and-push: diff --git a/src/main/java/com/nexters/goalpanzi/schedule/SchedulerConfig.java b/src/main/java/com/nexters/goalpanzi/schedule/SchedulerConfig.java index 7214c55d..a27b8ed1 100644 --- a/src/main/java/com/nexters/goalpanzi/schedule/SchedulerConfig.java +++ b/src/main/java/com/nexters/goalpanzi/schedule/SchedulerConfig.java @@ -6,18 +6,13 @@ import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerException; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Lazy; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.scheduling.quartz.SchedulerFactoryBean; -import org.springframework.stereotype.Component; +import org.springframework.context.annotation.Configuration; import java.util.List; @Slf4j @RequiredArgsConstructor -@Component +@Configuration public class SchedulerConfig { private final Scheduler scheduler; private final List jobList; diff --git a/src/main/java/com/nexters/goalpanzi/schedule/SchedulerFactoryConfig.java b/src/main/java/com/nexters/goalpanzi/schedule/SchedulerFactoryConfig.java index de819c8f..ddd595b7 100644 --- a/src/main/java/com/nexters/goalpanzi/schedule/SchedulerFactoryConfig.java +++ b/src/main/java/com/nexters/goalpanzi/schedule/SchedulerFactoryConfig.java @@ -1,10 +1,12 @@ package com.nexters.goalpanzi.schedule; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.quartz.SchedulerFactoryBean; +import org.springframework.scheduling.quartz.SpringBeanJobFactory; @Configuration public class SchedulerFactoryConfig { @@ -21,12 +23,21 @@ public ThreadPoolTaskExecutor executor() { return executor; } + @Bean + public SpringBeanJobFactory jobFactory(ApplicationContext ctx) { + SpringBeanJobFactory springBeanJobFactory = new SpringBeanJobFactory(); + springBeanJobFactory.setApplicationContext(ctx); + return springBeanJobFactory; + } + @Bean public SchedulerFactoryBean schedulerFactory( - @Qualifier(SCHEDULER_THREAD_POOL_EXECUTOR) ThreadPoolTaskExecutor threadPoolTaskExecutor + @Qualifier(SCHEDULER_THREAD_POOL_EXECUTOR) ThreadPoolTaskExecutor threadPoolTaskExecutor, + SpringBeanJobFactory jobFactory ) { SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setTaskExecutor(threadPoolTaskExecutor); + factory.setJobFactory(jobFactory); return factory; } }