records for springbatch

Where is the answer about this title?
How to make a great construct for this title?
The answer is:

One reader

One Processor but return a super class Object of A type and B type data
the one processor translate one data to two different values
but classifier this values to different writers

Like the code blows here:

public List<SuperMonitor> process(T item){
    List<SuperMonitor> superList = new ArrayList<>();
    Future<List<BarMonitor>> barList = translateA(item);
    Future<List<FooMonitor>> fooList = translateB(item);

    superList.addAll(barList);
    superList.addAll(fooList);
    return superList;
}

And through the Classifier writers to dispatching the superMonitorList
The classifier instance should be like this blows:

obj instance of BarMonitor -> insert update to bar table
obj instance of FooMonitor -> insert update to foo table

Or
Use the Classifier writer by spring batch provided
SuperClass or SubClass classifier modules

原文地址:https://www.cnblogs.com/ukzq/p/15340272.html