R – Spring Batch resourceless JobRepository

jakarta-eespring-batch

I'm using Spring Batch for a system that does a lot of batch operations.
I'm using SimpleJobRepository with in memory DAOs.
I would like to know if there is a way to avoid using a JobRepository? something similar to the resourceless transaction manager?
The reason i'm asking is that the system should run constantly without restarting and i have some concerns about the memory it will be consuming.
I know i can use a database based JobRepositry, but frankly, I really don't need one at all.

If there is no way to do so i will appreciate it if someone can reassure me about the memory consumption problem.

Thanks.

Best Answer

You must use job repository as it holds info about the job context. the solution for your case is - make your job repository with scope="prototype" this will cerate a new in-memory dao (map implementation) for each job, and thus no memory problem. the overhead of creating new instance each time is meaningless in terms of batch jobs.

Related Topic