diff --git a/src/main/java/kr/pickple/back/batch/BatchConfig.java b/src/main/java/kr/pickple/back/batch/BatchConfig.java index 187ee087..8018328b 100644 --- a/src/main/java/kr/pickple/back/batch/BatchConfig.java +++ b/src/main/java/kr/pickple/back/batch/BatchConfig.java @@ -6,20 +6,16 @@ import org.springframework.batch.core.job.builder.JobBuilder; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; -import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.transaction.PlatformTransactionManager; -import kr.pickple.back.game.repository.GameRepository; import lombok.RequiredArgsConstructor; @Configuration @RequiredArgsConstructor public class BatchConfig extends DefaultBatchConfiguration { - private final GameRepository gameRepository; - @Bean public Job job( final JobRepository jobRepository, @@ -32,20 +28,10 @@ public Job job( .build(); } - @Bean - public Tasklet gameClosedTasklet() { - return new GameClosedTasklet(gameRepository); - } - - @Bean - public Tasklet gameEndedTasklet() { - return new GameEndedTasklet(gameRepository); - } - @Bean public Step updateGameStatusToClosedStep( final JobRepository jobRepository, - final Tasklet gameClosedTasklet, + final GameClosedTasklet gameClosedTasklet, final PlatformTransactionManager transactionManager ) { return new StepBuilder("updateGameStatusToClosedStep", jobRepository) @@ -56,7 +42,7 @@ public Step updateGameStatusToClosedStep( @Bean public Step updateGameStatusToEndedStep( final JobRepository jobRepository, - final Tasklet gameEndedTasklet, + final GameEndedTasklet gameEndedTasklet, final PlatformTransactionManager transactionManager ) { return new StepBuilder("updateGameStatusToEndedStep", jobRepository) diff --git a/src/main/java/kr/pickple/back/batch/GameClosedTasklet.java b/src/main/java/kr/pickple/back/batch/GameClosedTasklet.java index 92efe802..50a0dd42 100644 --- a/src/main/java/kr/pickple/back/batch/GameClosedTasklet.java +++ b/src/main/java/kr/pickple/back/batch/GameClosedTasklet.java @@ -9,6 +9,7 @@ import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.repeat.RepeatStatus; +import org.springframework.stereotype.Component; import kr.pickple.back.game.domain.Game; import kr.pickple.back.game.repository.GameRepository; @@ -16,6 +17,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j +@Component @RequiredArgsConstructor public class GameClosedTasklet implements Tasklet { diff --git a/src/main/java/kr/pickple/back/batch/GameEndedTasklet.java b/src/main/java/kr/pickple/back/batch/GameEndedTasklet.java index 14292b95..f748ece4 100644 --- a/src/main/java/kr/pickple/back/batch/GameEndedTasklet.java +++ b/src/main/java/kr/pickple/back/batch/GameEndedTasklet.java @@ -9,6 +9,7 @@ import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.repeat.RepeatStatus; +import org.springframework.stereotype.Component; import kr.pickple.back.game.domain.Game; import kr.pickple.back.game.repository.GameRepository; @@ -16,6 +17,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j +@Component @RequiredArgsConstructor public class GameEndedTasklet implements Tasklet {