1. What’s New in Spring Batch 4.0
The Spring Batch 4.0 release has four major themes:
-
Java 8 Requirement
-
Dependencies Re-baseline
-
Builders for ItemReaders and ItemWriters
-
New serialization mechanism
1.1. Java 8 Requirement
Spring Batch has historically followed Spring Framework’s baselines for both java version and third party dependencies. With Spring Batch 4, the Spring Framework version is being upgraded to Spring Framework 5. As a result, the Java version requirement for Spring Batch is also increasing to Java 8. This should be mainly an internal change, in that most of the framework has supported things like functional interfaces and lambdas since they were released.
1.2. Dependencies Re-baseline
In order to continue to integrate with supported versions of the third party libraries Spring Batch uses, Spring Batch 4 is updating the dependencies across the board. The new dependency versions align with Spring Framework 5.
1.3. Provide builders for the ItemReaders, ItemProcessors, and ItemWriters
Spring Batch 4 is providing a collection of builders for all of the ItemReader
implementations and ItemWriter
implementations that come with the framework. As of
this release, builders for the following components (as well as some related utility
builders) are available:
-
AmqpItemReader
-AmqpItemReaderBuilder
-
ClassifierCompositeItemProcessor
-ClassifierCompositeItemProcessorBuilder
-
ClassifierCompositeItemWriter
-ClassifierCompositeItemWriterBuilder
-
CompositeItemWriter
-CompositeItemWriterBuilder
-
FlatFileItemReader
-FlatFileItemReaderBuilder
-
FlatFileItemWriter
-FlatFileItemWriterBuilder
-
GemfireItemWriter
-GemfireItemWriterBuilder
-
HibernateCursorItemReader
-HibernateCursorItemReaderBuilder
-
HibernateItemWriter
-HibernateItemWriterBuilder
-
HibernatePagingItemReader
-HibernatePagingItemReaderBuilder
-
JdbcBatchItemWriter
-JdbcBatchItemWriterBuilder
-
JdbcCursorItemReader
-JdbcCursorItemReaderBuilder
-
JdbcPagingItemReader
-JdbcPagingItemReaderBuilder
-
JmsItemReader
-JmsItemReaderBuilder
-
JmsItemWriter
-JmsItemWriterBuilder
-
JpaPagingItemReader
-JpaPagingItemReaderBuilder
-
MongoItemReader
-MongoItemReaderBuilder
-
MultiResourceItemReader
-MultiResourceItemReaderBuilder
-
MultiResourceItemWriter
-MultiResourceItemWriterBuilder
-
Neo4jItemWriter
-Neo4jItemWriterBuilder
-
RepositoryItemReader
-RepositoryItemReaderBuilder
-
RepositoryItemWriter
-RepositoryItemWriterBuilder
-
ScriptItemProcessor
-ScriptItemProcessorBuilder
-
SimpleMailMessageItemWriter
-SimpleMailMessageItemWriterBuilder
-
SingleItemPeekableItemReader
-SingleItemPeekableItemReaderBuilder
-
StaxEventItemReader
-StaxEventItemReaderBuilder
-
StaxEventItemWriter
-StaxEventItemWriterBuilder
-
SynchronizedItemStreamReader
-SynchronizedItemStreamReaderBuilder
1.4. New serialization mechanism
Before Spring Batch 4, the default serialization mechanism for the ExecutionContext
was based on the XStream
library. In this release, the serialization mechanism
has been changed to use Jackson
by default.
The new serialization format is not compatible with the old serialization format.
The old serialization mechanism based on XStreamExecutionContextStringSerializer
is still available but is now deprecated and will be removed in a future version.
If the old format needs to be used with Spring Batch 4, it should be configured by
implementing a BatchConfigurer
and overriding the configuration in the
JobRepositoryFactoryBean
and JobExplorerFactoryBean
.