Search Tutorials


What is Spring Batch? Need for Spring Batch | JavaInUse

What is Spring Batch?

What is Batch Processing?

Batch processing is the processing of a finite amount of data in a manner that does not require external interaction or interruption. Using batch processing we run jobs without end user interaction. These jobs can be scheduled based on the availability of resources.
What is batch job

Batch jobs help process a large amount of data. So the output might not be immediately available. Still there is always some deadline defined for batch jobs. For example some batch jobs related to payroll data of an organization need to be processed by 30th or 31st i.e. last day of every month so that bank can be notified to process the salary amount on the 1st. Also some batch jobs need to be run when there is less load on the system. For example there are many nightly and weekend batch runs done in banks when the system load is less.

Video

This tutorial is explained in the below Youtube Video.

What is Spring Batch

Spring Batch is the de facto standard for batch processing on the JVM. Spring Batch is a lightweight, open source framework for executing batch jobs. The Spring Batch framework (Spring Batch) was developed as a collaboration between Accenture and SpringSource as a standards-based way to implement common batch patterns and paradigms.

Features of Spring Batch -


Spring Batch
  • Built on top of Spring Framework - A developer can also execute batch job by writing code from scratch. However this will need a lot of efforts. Spring Batch is based on the Spring Framework which is a popular enterprise framework with features like dependency injection. Spring Batch is open sourced and provides ready to use functionalities which are being used widely and thoroughly test.
  • State Management - When running a job using spring batch, the job is usually broken down into logical steps and executed accordingly. All the states of these steps are persisted using spring batch. So we know the exact status and other metadata related to the job.
  • Error Handling - As we discussed previously batch jobs are usually run overnight without any external interruptions. So if any exceptions were to occur it should be handled by the spring batch framework itself. Spring batch provides robust error handling.
  • Scalability - Spring batch provides a number of ways like partitioning, remote chunking, parallel steps etc to achieve scaling.