How can I start with Spring Batch?

I am trying to learn the Spring Package , but the startup guide is very confusing. Comments similar to

You can get a pretty good idea of ​​how to create a job by examining unit tests in the org.springframework.batch.sample package (in src / main / java) and configurations in SRC / main / resources / jobs.

not quite helpful. I also find the project example very complex (17 non-empty namespaces with 109 classes)! Is there an easier place to get started with Spring Batch?

+45
spring batch
Oct 22 '09 at 20:36
source share
8 answers
+35
Oct 22 '09 at 21:41
source share

I agree that the user guide is very confusing (compared to the Spring Core user guide anyway). It does not adequately address some very important errors that you will encounter in any medium-term batch scenario.

The important things you need to deploy as a new starter and decide on your requirements,

  • exception configuration (when to skip, when to fail, when to retry)
  • using execution context to maintain state (for example, when to use script execution context and job execution context).
  • general state maintenance (use step area, especially for input parameters)

However, it is persistent. Batch programming is very different from other server-side styles and greatly benefits from Spring's usual "picture abstraction" approach.

+6
Dec 11 '09 at 15:37
source share

I recently gave Spring Batch a real try. I will say that in my implementation I used the repository in memory (because reboots and retries were not a priority in my project), but I can appreciate what Richard says about JobRepository: you basically have to dig deep to find the base schemas data.

For Spring Batch 2.1, they provide some documentation in the repository: http://static.springsource.org/spring-batch/reference/html/metaDataSchema.html , including discussions on how to handle the database-specific implementations. The DDL for creating tables is in the main Spring Batch JAR file:

spring -batch-core-2.1.0.RELEASE.jar: ./ org / springframework / batch / core / SQL *

Scripts are available for DB2, Derby, H2, HSQLDB, MySQL, Oracle 10g, PostgreSQL, MS SQL, and Sybase.

+5
May 07 '10 at 20:35
source share

Before you upgrade to Spring Batch Station Wagon, you can read what cletus own user has to say about its shortcomings:

http://www.cforcoding.com/2009/07/spring-batch-or-how-not-to-design-api.html

I recently evaluated the Spring package and quickly rejected it when I realized that it wasn’t adding anything to my project except for bloating and overhead. The Spring Package may eventually become an OK product (just as EJB got this right this time), but at the moment it looks suspiciously like a solution to finding a problem.

+4
Oct 26 '09 at 18:25
source share

In this tutorial, we will create a simple Spring batch application to demonstrate how to handle a series of jobs in which the main goal is to import comma-separated and fixed-length record lists. In addition, we will add a web interface using Spring MVC to teach how to run tasks manually, and so that we can visually check imported records. In the data layer we will use JPA, Hibernate and MySQL.

+4
Dec 12 '12 at 6:29
source share

https://github.com/langmi/spring-batch-examples

This contains some pretty good basic examples.

+3
Aug 23 '11 at 12:27
source share

I was just starting to see Spring Batch as a possible replacement for our internal batch structure. In fact, creating a batch server with the ability to schedule Jobs and the JMX interface from above to provide an overview of running / previously running job instances took no more than one day. However, like Caoilte, I find it difficult to document. The main and one that is missing from the documentation or javadocs is that the tables are required by JobRepository. By default, the database-based JobRepository resource is used, which is one of the requirements of my new server, but I cannot find mention of the required tables. I had to search Google in high and low condition for any mention of them (if they are in the documentation, then I gladly put salt on my modest cake).

I think that actually creating a package to work in Spring is a rather difficult task, given the wide range of configuration options available to you. This is the power in my eyes. It provides options for setting up complex batch tasks in xml, which I have yet to find in any other batch structure (that I know). But if you really didn’t want to use the power of Spring Batch, why not just create a job with a single plate step (but then you should ask yourself if this is worth the overhead).

+1
Feb 24 '10 at 13:35
source share

It’s too bad that you guys abandoned it, in fact the structure is really great. But if someone else needs to get started quickly, try: Spring Quick Start

/ Anatoly

+1
Apr 08 2018-10-10T00:
source share



All Articles