Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreOn behalf of the team and all contributors, I am pleased to announce that Spring Batch 6.1.0-M2 is available now from Maven Central! This second milestone brings a number of new features, enhancements and a few breaking changes on top of 6.1.0-M1.
This blog post walks you through the major changes:
DefaultFormattingConversionServicespring-batch-coreRepositoryItemWriterFor the complete list of changes, please check the release notes.
Spring dependencies are upgraded to the following versions:
The MongoDB job repository now supports a configurable collection prefix, similar to the table prefix of the JDBC job repository. This makes it possible to run several applications against the same MongoDB database, or to isolate environments from each other:
@EnableBatchProcessing
@EnableMongoJobRepository(collectionPrefix = "MY_APP_")
class MyJobConfiguration {
// job definition omitted
}
The prefix defaults to BATCH_, so existing applications are not affected.
DefaultFormattingConversionServiceThe job repository now builds its default conversion service on top of Spring Framework's DefaultFormattingConversionService, exposed through a new ConversionServiceFactory utility class, instead of a set of hand-written converters. The same job parameter formats are preserved, while benefiting from the broader set of converters and formatters provided out of the box. As a result, the previous date/time converters are now deprecated in favor of ConversionServiceFactory#createConversionService().
spring-batch-coreAsyncItemProcessor, AsyncItemWriter, and ChunkTaskExecutorItemWriter have moved from spring-batch-integration to org.springframework.batch.core.step.item in spring-batch-core, since they only rely on a TaskExecutor and have no dependency on Spring Integration. This lets applications use asynchronous item processing and local chunking without pulling in spring-batch-integration and its transitive dependencies. The classes in spring-batch-integration are kept as deprecated subclasses for backward compatibility.
RepositoryItemWriterRepositoryItemWriter now supports flushing the underlying Spring Data repository after writing a chunk, either by naming a repository method that both saves and flushes (such as saveAllAndFlush), or by overriding the new flush method in a subclass.
MultiResourceItemReaderBuilder now accepts resource location patterns directly (for example "classpath:data/input/file-*.txt"), removing the need to resolve and inject resources beforehand. A new ResourcesItemReaderBuilder brings the same capability to ResourcesItemReader.
A few builders (FlatFileItemReaderBuilder, FlatFileItemWriterBuilder, JdbcBatchItemWriterBuilder) exposed pairs of methods configuring mutually exclusive strategies, only failing at build() time when both were called. These builders now use a staged DSL, so invalid combinations are rejected by the compiler instead. This is a source and binary breaking change for code that stores the builder's return value in a variable typed as the builder class; fluent call chains need no changes beyond a recompile. See issue #4888 for more details.
Several APIs have been deprecated in this release in favor of their replacements, including Apache Derby support, the legacy date/time converters, StepExecution#getJobExecutionId()/getJobParameters(), JobExecution#getJobInstanceId(), and a few count methods on JobRepository/JobExplorer/JobInstanceDao that could not soundly report unknown job/step names. All are scheduled for removal in version 7.0. For the full list, please refer to the reference documentation.
I would like to thank all contributors who had a role in this release! As we get closer to the 6.1 RC and GA releases, we look forward to your feedback on Github Issues, Github Discussions and X.