0

Is it possible in JSR-352 / Java Batch to have batch properties as List? How would they get initialized from the batch job XML?

public class MyItemProcessor extends ItemProcessor {
 @Inject
 @BatchProperty
 private List<String> items;
 public final Object processItem(Object o) throws Exception {
 ...
 }
}

Here is a skeleton batch job xml:

<?xml version="1.0" encoding="UTF-8"?>
<job xmlns="https://jakarta.ee/xml/ns/jakartaee" version="2.0" id="exportToExcel" restartable="true">
 <chunk item-count="10">
 ...some reader...
 <processor ref="MyItemProcessor">
 <properties>
 <property name="items"/> <-- how would the list of strings go in here?
 </properties>
 </processor>
 ...some writer...
 </chunk>
</job>
asked Mar 26, 2024 at 11:55

1 Answer 1

0
answered Mar 26, 2024 at 21:20
Sign up to request clarification or add additional context in comments.

2 Comments

It seems the examples parse a single string value to generate lists, dates, etc. Is there some more documentation about it? E.g. what to do if my strings contain commas?
commas will be interpreted as delimiter. For such values, it's better to inject them as string value and then parse it.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.