Java BatchProperty possible as List<String>?

40 Views Asked by At

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>
1

There are 1 best solutions below

2
cheng On BEST ANSWER