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
@@ -134,12 +140,24 @@ protected PlatformTransactionManager getTransactionManager() {
134
140
return this .transactionManager ;
135
141
}
136
142
143
+ @ Override
144
+ protected int getMaxVarCharLength () {
145
+ Integer maxVarCharLength = this .properties .getJdbc ().getMaxVarCharLength ();
146
+ return (maxVarCharLength != null ) ? maxVarCharLength : super .getMaxVarCharLength ();
147
+ }
148
+
137
149
@ Override
138
150
protected String getTablePrefix () {
139
151
String tablePrefix = this .properties .getJdbc ().getTablePrefix ();
140
152
return (tablePrefix != null ) ? tablePrefix : super .getTablePrefix ();
141
153
}
142
154
155
+ @ Override
156
+ protected boolean getValidateTransactionState () {
157
+ Boolean validateTransactionState = this .properties .getJdbc ().getValidateTransactionState ();
158
+ return (validateTransactionState != null ) ? validateTransactionState : super .getValidateTransactionState ();
159
+ }
160
+
143
161
@ Override
144
162
protected Isolation getIsolationLevelForCreate () {
145
163
Isolation isolation = this .properties .getJdbc ().getIsolationLevelForCreate ();
@@ -161,6 +179,12 @@ protected ExecutionContextSerializer getExecutionContextSerializer() {
161
179
: super .getExecutionContextSerializer ();
162
180
}
163
181
182
+ @ Override
183
+ protected JobParametersConverter getJobParametersConverter () {
184
+ return (this .jobParametersConverter != null ) ? this .jobParametersConverter
185
+ : super .getJobParametersConverter ();
186
+ }
187
+
164
188
@ Override
165
189
protected TaskExecutor getTaskExecutor () {
166
190
return (this .taskExector != null ) ? this .taskExector : super .getTaskExecutor ();
0 commit comments