|
22 | 22 |
|
23 | 23 | import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
24 | 24 | import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
|
| 25 | +import org.springframework.batch.core.converter.JobParametersConverter; |
25 | 26 | import org.springframework.batch.core.explore.JobExplorer;
|
26 | 27 | import org.springframework.batch.core.launch.JobLauncher;
|
27 | 28 | import org.springframework.batch.core.repository.ExecutionContextSerializer;
|
|
66 | 67 | * @author Mahmoud Ben Hassine
|
67 | 68 | * @author Lars Uffmann
|
68 | 69 | * @author Lasse Wulff
|
| 70 | + * @author Yanming Zhou |
69 | 71 | * @since 1.0.0
|
70 | 72 | */
|
71 | 73 | @AutoConfiguration(after = { HibernateJpaAutoConfiguration.class, TransactionAutoConfiguration.class })
|
@@ -110,18 +112,22 @@ static class SpringBootBatchConfiguration extends DefaultBatchConfiguration {
|
110 | 112 |
|
111 | 113 | private final ExecutionContextSerializer executionContextSerializer;
|
112 | 114 |
|
| 115 | + private final JobParametersConverter jobParametersConverter; |
| 116 | + |
113 | 117 | SpringBootBatchConfiguration(DataSource dataSource, @BatchDataSource ObjectProvider<DataSource> batchDataSource,
|
114 | 118 | PlatformTransactionManager transactionManager,
|
115 | 119 | @BatchTransactionManager ObjectProvider<PlatformTransactionManager> batchTransactionManager,
|
116 | 120 | @BatchTaskExecutor ObjectProvider<TaskExecutor> batchTaskExecutor, BatchProperties properties,
|
117 | 121 | ObjectProvider<BatchConversionServiceCustomizer> batchConversionServiceCustomizers,
|
118 |
| - ObjectProvider<ExecutionContextSerializer> executionContextSerializer) { |
| 122 | + ObjectProvider<ExecutionContextSerializer> executionContextSerializer, |
| 123 | + ObjectProvider<JobParametersConverter> jobParametersConverter) { |
119 | 124 | this.dataSource = batchDataSource.getIfAvailable(() -> dataSource);
|
120 | 125 | this.transactionManager = batchTransactionManager.getIfAvailable(() -> transactionManager);
|
121 | 126 | this.taskExector = batchTaskExecutor.getIfAvailable();
|
122 | 127 | this.properties = properties;
|
123 | 128 | this.batchConversionServiceCustomizers = batchConversionServiceCustomizers.orderedStream().toList();
|
124 | 129 | this.executionContextSerializer = executionContextSerializer.getIfAvailable();
|
| 130 | + this.jobParametersConverter = jobParametersConverter.getIfAvailable(); |
125 | 131 | }
|
126 | 132 |
|
127 | 133 | @Override
|
@@ -161,6 +167,12 @@ protected ExecutionContextSerializer getExecutionContextSerializer() {
|
161 | 167 | : super.getExecutionContextSerializer();
|
162 | 168 | }
|
163 | 169 |
|
| 170 | + @Override |
| 171 | + protected JobParametersConverter getJobParametersConverter() { |
| 172 | + return (this.jobParametersConverter != null) ? this.jobParametersConverter |
| 173 | + : super.getJobParametersConverter(); |
| 174 | + } |
| 175 | + |
164 | 176 | @Override
|
165 | 177 | protected TaskExecutor getTaskExecutor() {
|
166 | 178 | return (this.taskExector != null) ? this.taskExector : super.getTaskExecutor();
|
|
0 commit comments