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>
Yes. see JBeret examples below. This is specific to JBeret, not a standard feature in Java Batch spec.
See JBeret Docs for more info. The list value can be simple comma-separated string values.