The official Spring Batch documentation has a page dedicated to this: https://docs.spring.io/spring-batch/reference/step/chunk-oriented-processing/commit-interval.html#page-title
Is that what you are looking for?