Skip to content

Commit

Permalink
refactor: 의존 주입 방식 변경 및 메서드 명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Hchanghyeon committed Dec 2, 2023
1 parent cc5197b commit a5c61f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@

@Configuration
@RequiredArgsConstructor
public class BatchConfig extends DefaultBatchConfiguration {
public class GameBatchConfig extends DefaultBatchConfiguration {

private final GameEndedTasklet gameEndedTasklet;
private final GameClosedTasklet gameClosedTasklet;

@Bean
public Job job(
public Job updateGameStatusJob(
final JobRepository jobRepository,
final Step updateGameStatusToClosedStep,
final Step updateGameStatusToEndedStep
Expand All @@ -31,22 +34,20 @@ public Job job(
@Bean
public Step updateGameStatusToClosedStep(
final JobRepository jobRepository,
final GameClosedTasklet gameClosedTasklet,
final PlatformTransactionManager transactionManager
final PlatformTransactionManager platformTransactionManager
) {
return new StepBuilder("updateGameStatusToClosedStep", jobRepository)
.tasklet(gameClosedTasklet, transactionManager)
.tasklet(gameClosedTasklet, platformTransactionManager)
.build();
}

@Bean
public Step updateGameStatusToEndedStep(
final JobRepository jobRepository,
final GameEndedTasklet gameEndedTasklet,
final PlatformTransactionManager transactionManager
final PlatformTransactionManager platformTransactionManager
) {
return new StepBuilder("updateGameStatusToEndedStep", jobRepository)
.tasklet(gameEndedTasklet, transactionManager)
.tasklet(gameEndedTasklet, platformTransactionManager)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
@Component
@RequiredArgsConstructor
public class BatchScheduler {
public class GameBatchScheduler {

private final JobLauncher jobLauncher;
private final Job job;
private final Job updateGameStatusJob;

@Scheduled(cron = "0 0/30 * * * *")
public void runJob() {
public void runUpdateGameStatusJob() {
try {
jobLauncher.run(
job,
updateGameStatusJob,
new JobParametersBuilder()
.addString("dateTime", LocalDateTime.now().toString())
.toJobParameters()
Expand Down

0 comments on commit a5c61f6

Please sign in to comment.