eHarmony Engineering logo

Spring Batch Admin – The Tricky Parts

June 26, 2014

In the Matching Engineering team at eHarmony, our projects use the Spring Batch and Spring Data frameworks extensively. As the frameworks became more mature, we realized that a GUI control mechanism would be useful.

The new GUI needed to support features like monitoring executing runs, starting and stopping jobs, and using a well-defined API remotely.

After a bit of investigation, we decided on Spring Batch Admin, a framework implemented on top of Spring Batch. It contained all the features we needed: a GUI for monitoring, manual triggering and recovery of the jobs, and a RESTful API to trigger jobs.

At first glance everything was amazing.  However, when we ran a test setup of the stand alone Spring Batch Admin web application, issues arose when trying to integrate it with the existing application.

This post presents some tricky things we had to do to make it work with our existing setup.

Our project is written in Java/Groovy and uses the Maven project object model.

This post assumes that you have already visited the Spring Batch Admin website ( and are trying to integrate it into your existing project.

First of all, to use Spring Batch Admin in your project, you need to declare the following dependency in the pom.xml file.


Here come the tricky parts!

In order to incorporate and override the spring configuration from Spring Batch Admin, the following exact structure needs to be specified.

In the src/main/resources, create a directory structure with these files:

| |____spring
| | |____batch
| | | |____jobs
| | | | |____spring-batch-alias.xml
| | | |____override
| | | | |____manager
| | | | | |____env-context.xml

Please note that Spring Batch Admin loads application context only if it is in that specific directory structure, however instead of putting all my application-specific items in that directory, I prefer an alias spring-batch-alias.xml file to the actual context file.

    <!-- Instead of copying all the configuration files to directory, it is much cleaner  -->
    <!-- to create this alias config file. Spring-batch-admin-manager will scan this directory -->
    <!-- structure for loading the job definitions. META-INF/spring/batch/jobs/ -->

Please note that namespace URLs have been truncated for better readability.
Below is the content of the env-context.xml file, which allows you to load and use additional property files.

    <!--  Use this to set additional properties on beans at run time -->


Note that this property is not required, however I left it there for compatibility purposes (it is in all examples of Spring Batch Admin and is useful if you have different database configurations and want to specify which one to use for storing metadata externally):


In my case, there is only a default property file spring-batch-admin/, so besides the META-INF directory, I also have the following files:

| |
| |____business-schema.sql

# Default placeholders for database platform independent features

# Set to False to stop the database from being wiped and re-created.

# MySQL:
#batch.jdbc.validationQuery=SELECT 1

# Oracle:


Note that it is an empty file, however I had to add it — the Spring Batch Admin requires that file to exist. I’m not sure whether they have already fixed that issue.

I have included comments in the files wherever possible, to make it clear why certain properties have specified values.

Those are the tricky things I had to do to incorporate Spring Batch Admin into our project. Hope this post saves you some trouble when trying to configure it for yours.