skpraveen
skpraveen

Reputation: 303

How to print the name of the files that are processed?

I am using MultiResourceItemReader to read multiple csv files from a directory. I would want to log the file names when the read of records from it starts. Tried the option of my Pojo implements ResourceAware & printing the resource.getFileName(). But this method gets invoked every time.

Is there a way to have the fileName only once when the read starts ?

Upvotes: 0

Views: 237

Answers (1)

user180100
user180100

Reputation:

I would extends the MultiResourceItemReader and override setResources():

@Override
void setResources(Resources resources) {
    // print out using `resources`
    super.setResources(resources);
}

Upvotes: 1

Related Questions