@@ -191,6 +191,37 @@ public static RuntimeBeanReference getStateTransitionReference(ParserContext par
191
191
192
192
}
193
193
194
+ /**
195
+ * @param element
196
+ * @param parserContext
197
+ * @return the TaskletStep bean
198
+ */
199
+ protected RootBeanDefinition parseSimpleTask (Element element , ParserContext parserContext ) {
200
+
201
+ RootBeanDefinition bd = new RootBeanDefinition ("org.springframework.batch.core.step.tasklet.TaskletStep" , null , null );
202
+
203
+ String taskletBeanId = element .getAttribute ("tasklet" );
204
+ if (StringUtils .hasText (taskletBeanId )) {
205
+ RuntimeBeanReference taskletRef = new RuntimeBeanReference (taskletBeanId );
206
+ bd .getPropertyValues ().addPropertyValue ("tasklet" , taskletRef );
207
+ }
208
+
209
+ String jobRepository = element .getAttribute ("job-repository" );
210
+ RuntimeBeanReference jobRepositoryRef = new RuntimeBeanReference (jobRepository );
211
+ bd .getPropertyValues ().addPropertyValue ("jobRepository" , jobRepositoryRef );
212
+
213
+ String transactionManager = element .getAttribute ("transaction-manager" );
214
+ RuntimeBeanReference tx = new RuntimeBeanReference (transactionManager );
215
+ bd .getPropertyValues ().addPropertyValue ("transactionManager" , tx );
216
+
217
+ handleListenersElement (element , bd , parserContext , "stepExecutionListeners" );
218
+
219
+ bd .setRole (BeanDefinition .ROLE_SUPPORT );
220
+
221
+ return bd ;
222
+
223
+ }
224
+
194
225
/**
195
226
* @param element
196
227
* @param parserContext
@@ -301,7 +332,7 @@ protected RootBeanDefinition parseProcessTask(Element element, ParserContext par
301
332
302
333
handleExceptionElement (element , bd , "fatal-exception-classes" , "fatalExceptionClasses" , isFaultTolerant );
303
334
304
- handleListenersElement (element , bd , parserContext );
335
+ handleListenersElement (element , bd , parserContext , "listeners" );
305
336
306
337
handleRetryListenersElement (element , bd , parserContext );
307
338
@@ -352,7 +383,7 @@ private void handleExceptionElement(Element element, RootBeanDefinition bd,
352
383
}
353
384
354
385
@ SuppressWarnings ("unchecked" )
355
- private void handleListenersElement (Element element , RootBeanDefinition bd , ParserContext parserContext ) {
386
+ private void handleListenersElement (Element element , RootBeanDefinition bd , ParserContext parserContext , String property ) {
356
387
Element listenersElement =
357
388
DomUtils .getChildElementByTagName (element , "listeners" );
358
389
if (listenersElement != null ) {
@@ -361,7 +392,7 @@ private void handleListenersElement(Element element, RootBeanDefinition bd, Pars
361
392
listenerBeans );
362
393
ManagedList arguments = new ManagedList ();
363
394
arguments .addAll (listenerBeans );
364
- bd .getPropertyValues ().addPropertyValue ("listeners" , arguments );
395
+ bd .getPropertyValues ().addPropertyValue (property , arguments );
365
396
}
366
397
}
367
398
@@ -448,33 +479,4 @@ private void handleStreamsElement(Element element, RootBeanDefinition bd, Parser
448
479
}
449
480
}
450
481
451
- /**
452
- * @param element
453
- * @param parserContext
454
- * @return the TaskletStep bean
455
- */
456
- protected RootBeanDefinition parseSimpleTask (Element element , ParserContext parserContext ) {
457
-
458
- RootBeanDefinition bd = new RootBeanDefinition ("org.springframework.batch.core.step.tasklet.TaskletStep" , null , null );
459
-
460
- String taskletBeanId = element .getAttribute ("tasklet" );
461
- if (StringUtils .hasText (taskletBeanId )) {
462
- RuntimeBeanReference taskletRef = new RuntimeBeanReference (taskletBeanId );
463
- bd .getPropertyValues ().addPropertyValue ("tasklet" , taskletRef );
464
- }
465
-
466
- String jobRepository = element .getAttribute ("job-repository" );
467
- RuntimeBeanReference jobRepositoryRef = new RuntimeBeanReference (jobRepository );
468
- bd .getPropertyValues ().addPropertyValue ("jobRepository" , jobRepositoryRef );
469
-
470
- String transactionManager = element .getAttribute ("transaction-manager" );
471
- RuntimeBeanReference tx = new RuntimeBeanReference (transactionManager );
472
- bd .getPropertyValues ().addPropertyValue ("transactionManager" , tx );
473
-
474
- bd .setRole (BeanDefinition .ROLE_SUPPORT );
475
-
476
- return bd ;
477
-
478
- }
479
-
480
482
}
0 commit comments