0

I have a job that process all the csv files in a folder and move them to another location.

I've scheduled (@Scheduled) this Job to execute over a time interval and i noticed that the file list it's not updated.

Here is the configuration used to map all the files in the folder:

@Value("file:${app.hotfolder_path}${app.filename_regex}")
private Resource[] inputResources;

I need to update this property on every job execution because the file list change over time (Once a day). Is there an easy way to achieve this? Thank you in advance.

1 Answer 1

1

It seems that these resources are injected in a singleton bean, hence the resolved value will remain the same for the entire application context lifetime.

Since resources are moved on each run, they should be resolved inside the scheduled method (to be recalculated each time) and not as an instance variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.