This is the third post about the new Java based configuration features in Spring Batch 2.2. In the first post I compared the two configuration styles on a non-trivial batch job reading from a file and writing to a database. I used a very simple infrastructure setup with an In-Memory-Database and a DataSourceTransactionManager, and I didn’t have any property files to read configurable data from. This post is about adding another infrastructure configuration for a production environment.
In future posts I will talk about job inheritance, modular configurations and partitioning and multi-threaded step, everything regarding Java based configuration, of course. You can find the JavaConfig code examples on Github.
(read more…)
Spring Batch 2.2 – JavaConfig Part 3: Profiles and environments
Spring Batch 2.2 – JavaConfig Part 2: JobParameters, ExecutionContext and StepScope
This is the second post about the new Java based configuration features in Spring Batch 2.2. In the first post I compared the two configuration styles on a non-trivial batch job reading from a file and writing to a database.
In the first version of the job, I hard-coded the filename into the configuration of the FlatfileItemReader.
@Bean public FlatFileItemReader<partner> reader(){ FlatFileItemReader</partner><partner> itemReader = new FlatFileItemReader</partner><partner>(); itemReader.setLineMapper(lineMapper()); itemReader.setResource(new ClassPathResource("partner-import.csv")); return itemReader; } </partner> |
This sounds like a bad idea, because maybe I want to execute the job on different files. It would be good if it was a job parameter. So, this post is about accessing job parameters and execution contexts in Java based configuration.
In future posts I will talk about profiles and environments, job inheritance, modular configurations and partitioning and multi-threaded step, everything regarding Java based configuration, of course. You can find the JavaConfig code examples on Github.
(read more…)
Spring Batch 2.2 – JavaConfig Part 1: A comparison to XML
This is the first part of a series on Java based configuration in Spring Batch. Spring Batch 2.2 will be out in a few weeks (update: was released 6/6), and it will have a Java DSL for Spring Batch, including its own @Enable annotation. In Spring Core I prefer Java based configuration over XML, but Spring Batch has a really good namespace in XML. Is the Java based approach really better? Time to take a deep look into the new features!
In this first post I will introduce the Java DSL and compare it to the XML version, but there’s more to come. In future posts I will talk about JobParameters, ExecutionContexts and StepScope, profiles and environments, job inheritance, modular configurations and partitioning and multi-threaded step, everything regarding Java based configuration, of course. You can find the JavaConfig code examples on Github. If you want to know when a new blog post is available, just follow me on Twitter (@TobiasFlohre) or Google+.
(read more…)
category:
English
Deutsch