Spring Batch 6.1.0-M2 is out!
TL;DR · AI 摘要
Title: Spring Batch 6.1.0-M2 is out! URL Source: Markdown Content: On behalf of the team and all contributors, I am plea...
核心要点
- 主题聚焦:Spring Batch 6.1.0-M2 is out!
- 来源:Spring Blog,建议结合原文判断细节。
- AI 分析暂不可用,本条为保底评分与摘要。
On 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:
- Dependencies upgrade
- Collection prefix for the MongoDB job repository
- Default conversion service based on
DefaultFormattingConversionService - Async processing APIs and local chunking moved to
spring-batch-core - Flushing support in
RepositoryItemWriter - Location patterns for resource-based readers
- Compile-time safety for mutually exclusive builder methods
- Deprecations
For the complete list of changes, please check the release notes.
Dependencies upgrade
Spring dependencies are upgraded to the following versions:
- Spring Framework 7.1.0-M2
- Spring Integration 7.2.0-M2
- Spring Data 2026.1.0-M2
- Spring LDAP 4.2.0-M1
- Spring AMQP 4.2.0-M2
- Spring Kafka 4.2.0-M2
- Micrometer 1.18.0-M2
Collection prefix for the MongoDB job repository
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.
Default conversion service based on `DefaultFormattingConversionService`
The 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().
Async processing APIs and local chunking moved to `spring-batch-core`
AsyncItemProcessor, 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.
Flushing support in `RepositoryItemWriter`
RepositoryItemWriter 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.
Location patterns for resource-based readers
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.
Compile-time safety for mutually exclusive builder methods
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.
Deprecations
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.
Feedback
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.
- * *