-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Grad Release 1.6.0
- Loading branch information
Showing
90 changed files
with
1,082 additions
and
685 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 18 additions & 8 deletions
26
api/src/main/java/ca/bc/gov/educ/api/batchgraduation/config/BatchConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,45 @@ | ||
package ca.bc.gov.educ.api.batchgraduation.config; | ||
|
||
import org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer; | ||
import org.springframework.batch.core.launch.JobLauncher; | ||
import org.springframework.batch.core.launch.support.SimpleJobLauncher; | ||
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher; | ||
import org.springframework.batch.core.repository.JobRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.core.task.SimpleAsyncTaskExecutor; | ||
import org.springframework.core.task.SyncTaskExecutor; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.TransactionManager; | ||
|
||
import javax.sql.DataSource; | ||
|
||
@Configuration | ||
@Profile("!test") | ||
@Component | ||
public class BatchConfig extends DefaultBatchConfigurer { | ||
public class BatchConfig { | ||
|
||
@Autowired | ||
public BatchConfig(@Qualifier("batchDataSource") DataSource batchDataSource) { | ||
super(batchDataSource); | ||
} | ||
DataSource dataSource; | ||
|
||
@Autowired | ||
TransactionManager transactionManager; | ||
|
||
@Bean(name = "asyncJobLauncher") | ||
public JobLauncher asyncJobLauncher(JobRepository jobRepository) throws Exception { | ||
SimpleJobLauncher jobLauncher = new SimpleJobLauncher(); | ||
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher(); | ||
jobLauncher.setJobRepository(jobRepository); | ||
jobLauncher.setTaskExecutor(new SimpleAsyncTaskExecutor()); | ||
jobLauncher.afterPropertiesSet(); | ||
return jobLauncher; | ||
} | ||
|
||
@Bean(name = "jobLauncher") | ||
public JobLauncher jobLauncher(JobRepository jobRepository) throws Exception { | ||
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher(); | ||
jobLauncher.setJobRepository(jobRepository); | ||
jobLauncher.setTaskExecutor(new SyncTaskExecutor()); | ||
jobLauncher.afterPropertiesSet(); | ||
return jobLauncher; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.