2020-06-28

Use of bulk writes in RepositoryItemWriter

Up to spring-batch version 4.2, it was required to specify the method name to use to save an item to the database. This method was then called in a for loop to save all items. In order to use CrudRepository.saveAll, it was required to extend RepositoryItemWriter and override write(List), which is not convenient.

In spring-batch v4.3.0 release, RepositoryItemWriter use CrudRepository.saveAll by default. This changes improves the performance of the writer by a factor of 2, according to our benchmark repository-item-writer-benchmark.

No comments:

Post a Comment