Spring Batch 2.2.0. Release Now Available
Join the DZone community and get the full member experience.
Join For FreeWe are pleased to announce that Spring Batch 2.2.0.RELEASE is now available via Maven Central, Github and the SpringSource download repository.
Spring Batch Home | Source on GitHub | Reference Documentation
Spring Batch Home | Source on GitHub | Reference Documentation
Support for Spring Data
Spring Data is a collection of projects intended to make it easier to develop Spring-powered applications that use new data access technologies such as non-relational (NoSQL) databases. Based on a model of exposing Repository objects, Spring Data allows applications to access data in a simple and consistent way across many new platforms. Spring Batch 2.2.0.RELEASE providesItemReader
implementations for Neo4J and MongoDB as well as ItemWriter
impelementaions for Neo4J, MongoDB and Gemfire. We also have created a RepositoryItemReader
and RepositoryItemWriter
. Each of these implementations wrap any custom implementation of PagingAndSortingRepository
and CrudRepository
respsectively.
Java Configuration
Joining most of the other major Spring projects, with Spring Batch 2.2.0.RELEASE, you will not be able to configure your batch jobs via Java config. The@EnableBatchProcessing
annotation provides access to not only builders that you can use to construct your batch jobs, but it adds the ability to autowire a number of useful objects (A JobRepository
, JobLauncher
, JobRegistry
, PlatformTransactionManager
) with no additional configuration required. Below is an example job configured via the new Java config.
@Configuration
@EnableBatchProcessing
@Import(DataSourceCnfiguration.class)
public class AppConfig {
@Autowired
private JobBuilderFactory jobs;
@Bean
public Job job() {
return jobs.get("myJob").start(step1()).next(step2()).build();
}
@Bean
protected Step step1() {
...
}
@Bean
protected Step step2() {
...
}
}
The above java config is equivelant to the below XML configuration.
<batch>
<job-repository />
<job id="myJob">
<step id="step1" .../>
<step id="step2" .../>
</job>
<beans:bean id="transactionManager" .../>
<beans:bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<beans:property name="jobRepository" ref="jobRepository" />
</beans:bean>
</batch>
Non-identifying Job Parameters
Running batch jobs that need the same parameters is a common use case. As of Spring Batch 2.2.0.RELEASE, Spring Batch now supports this use case by allowing jobs to accept non-identifying job parameters (parameters that do not contribute to the creation of a newJobInstance
). This update did require both code changes as well as updates to the underlying database schema used by the Spring Batch job repository. Fortunately, we have provided a migration script to help with the transition. You can read the details about the migration script in the Getting Started Guide.
AMQP support
Utilizing the Spring AMQP projet, Spring 2.2.0.RELEASE offers support for both reading and writing to AMQP endpoints.SQLFire support
Previous versions of Spring Batch provided a number of options for what database to use within the job repository. With the release of Spring Batch 2.2.0.RELEASE, we add support for SQLFire as yet another option for you to store job repository data.Dependency upgrade
As part of the ongoing work to keep the dependencies of Spring Batch up to date, we updated batch to support Spring 3.2.x (minimum level of support is now 3.1.2) as well as Hibernate 4 (within the Hibernate based ItemReaders and ItemWriters).Other updates and fixes
Beyond all of the new features, we also address many bugs and provided numerous other improvements. The complete list of what has changed between Spring Batch 2.2.0.RELEASE and your current version of Spring Batch can be found here in the changelog.Links
Spring Batch Home | Source on GitHub | Reference Documentation
Spring Batch
Spring Framework
Release (agency)
Opinions expressed by DZone contributors are their own.
Trending
-
Managing Data Residency, the Demo
-
Automating the Migration From JS to TS for the ZK Framework
-
What Is mTLS? How To Implement It With Istio
-
How To Design Reliable IIoT Architecture
Comments