A project that shows spring batch capabilities and integration with other frameworks (http://projects.spring.io/spring-batch/)
Note: Spring batch is configured to use latest version of spring, latest hibernate. However, excluding older versions of spring, hibernate is done in pom.xml
- Static Analysis QA Checks
- Project structure
- Build project
- Project parts
- Build configuration
- Logging configuration
- Features
- Tests
- Ideas to try
Jacoco
/cobertura
code coverage, pmd
, checkstyle
, enforcer
, findbugs
Maven project that consists of the following parts:
- Java main classes are under (
src/main/java
) with infrastructural elements - Each test file ends on
Test
and can be executed showing different features. Logging is provided on good level and configurable in log4j config via slf4j Test extensions for executing tests with spring batch (src/test/java
) and run during the build
mvn clean package
- Infrastructure. Contains spring batch components that might be used in other modules. Also contains common sql scripts.
- General. Contains general examples with different configurations and with integration with other frameworks/libraries
- JPA integrations. Contains jpa and hibernate examples that conflict with general examples because of spring version higher than spring batch uses
Libraries:
- spring-batch-core
- spring-integration
- spring-retry
- spring-jdbc for db population
- commons-dbcp2 for database connection pool
- h2 file based database for ease of db usage
- log4j logging (possibility to configure) via slf4j
Integration with:
- jpa
- hibernate
- mybatis
- mongo
- schedulers: cron and quartz
Spring batch logging logic.
- Slf4j is configured to use Log4j under the hood.
Main components are under src/main/java/org.spring.batch.infrastructure
folder.
completion_policy
for chunk completionlisteners
job and step listenersmodel
contains model to be used in examplespartitioner
partitioner implementationprocessors
step processorsreaders
step readersscheduler
scheduler componentsvalidator
job validatorswriters
job writers
Main features examples are under src/test/java
folder. Under main
package
It is simply test classes with test methods, that explain the feature and ready to be executed and provide log that shows the results.
concurrent
for concurrent featuresexceptional
for exceptional cases with skips, retries, failed statesgeneral
for simple demos with task executor, java config, jdbc xml configin_memory
with in memory simple reader/writers capabilities and integrationjsr352
with jsr job description examplemybatis
with Mybatis reader/writers capabilities and integrationpartitioner
with partitioner functionality featureretry
with two samples with stateless and stateful retryscheduler
with scheduling features based on cron and quartzhibernate
with Hibernate reader/writers capabilities and integration (hibernate dependency has dependency conflict. To enable example uncomment hibernate dependency)jpa
with JPA reader/writers capabilities and integration (hibernate dependency has dependency conflict. To enable example uncomment hibernate jpa dependency)- example with Hibernate
- example with EclipseLink (BasicDatasource is not supported, different Datasource implementation is used, HQL and JPQL difference)
- example with OpenJPA (HQL, JPQL and difference of query for openjpa)
Tests under src/test/java
general
- simple test demomongo
test with embedded and external modes NOTEmvn clean pre-integration-test -Dembedmongo.wait
to run mongodb locallyjava_config
test with spring batch java config and invocation of jobsystem_command
test with spring batch command tasklet to run command line commandparam_passing
test of passing parameters inside one step and between stepsretry
test for spring-retry annotation based functionalityspring_integration
test for integration of spring batch with spring integration framework. Poller, Transformer, Router, Email sending by Spring integration and job processing via spring batch.