Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreWe are pleased to announce that Spring Batch 4.0.0.M5 is now available via Github and the Pivotal download repository. This release represents the fifth milestone for the Spring Batch 4.0 release. Many thanks to all that contributed to this release.
This milestone continues the work laid out in the previous 4.0.0 milestones. Specific updates include:
FunctionItemProcessor
As the dependency graph of Spring Boot 2 evolves, we have been updating our dependencies to be in line with them. This round includes updates to pull in the GA release of Spring Framework 5 as well as Spring Data Kay. Spring Integration 5.0.0.M7 was also pulled in for this release.
FunctionItemProcessor
With Java 8 and the introduction of functional interfaces (from the java.util.function
package), it makes sense to review how those interfaces map into Spring Batch. The three key interfaces consist of the Supplier
, Function
, and Consumer
. This release provides an ItemProcessor
and related capabilities to enable the use of a Function
as an ItemProcessor
. An example may look something like this:
...
@Bean
public Function<String, String> upperCaseFunction() {
return o -> o.toUpperCase();
}
@Bean
public Step step1() {
return this.stepBuilderFactory.get("step1")
.<String, String>chunk(10)
.reader(reader())
.processor(upperCaseFunction())
.writer(writer())
.build();
}
...
Note that in the previous example, the actual Function implementation has zero Spring Batch dependencies. I can create a processor implementation that does not actually implement ItemProcessor
and use it as a processor within my step[1].
Between now and GA for Spring Batch, we'll begin to look at the other functional interfaces and their applicibility to Spring Batch.
The Spring Batch documentation hasn't had a major overhaul since java configuration became the norm. This release begins the transition of the documentation to address that. You'll see at the top of the following pages a toggle between Java and XML. That toggle will indicate how the examples within that page are configured (via Java based configuration or XML based configuration respectively). The pages this is currently implemented on are:
Before our next release we'll finish this migration to allow for ever example within the Spring Batch reference documentation to be illustrated both via Java configuration as well as XML configuration.
Looking ahead we'll be wrapping up the documentation updates. We'll also be looking at how the other functional interfaces fit into Spring Batch. Finally we'll pick up the rest of the Spring Framework ecosystem's latest dependencies in preparation for the GA release.
Spring Batch 4.0.0.M4 was released last Friday with an error in it and is not recommend for general consumption. 4.0.0.M5 is the latest milestone recommended to be consumed.
We look forward to your feedback on these new features in Jira, StackOverflow, or to me directly via Twitter @michaelminella!
Spring Batch Home | Source on GitHub | Reference Documentation
[1] Note: We are aware of the ItemProcessorAdapter
that existed and that it provided another way to accomplish using a service not implementing ItemProcessor
as an ItemProcessor
.