Git Product home page Git Product logo

spring-batch-sample's Introduction

Hello world running in spring batch

This repository exist to show how to integrate spring-batch into your application without too much issues. It was a battle to make this work, I hope to help some of you by publishing a working example.

Databases

Mysql

  • Running with mysql? add a -DENVIRONMENT=mysql to your JVM
  • Adapt database credential in src/main/resources/META-INF/spring/batch/override/data-source-context.xml
  • Ensure that src/main/resources/batch-mysql.properties exist in classpath

Oracle

  • Running with oracle? add a -DENVIRONMENT=oracle to your JVM
  • Adapt database credential in src/main/resources/META-INF/spring/batch/override/data-source-context.xml
  • Override job-repository so isolation-level-for-create="READ_COMMITTED"
  • Ensure that src/main/resources/batch-oracle.properties exist in classpath

Initializing datase

Ensure that at leas once in src/main/resources/batch-oracle.properties or src/main/resources/batch-mysql.properties the key batch.data.source.init=true or leave it always to false and run manually once the sql file schema-oracle10g.properties or schema-mysql.properties

Running spring batch ui not in context path root

so intead of https://localhost/dev/ you want to run spring batch admin ui in https://localhost/dev/batch

adapt web.xml

        <servlet-name>Batch Servlet</servlet-name>
        <url-pattern>/batch/*</url-pattern>
</servlet-mapping>

and uncomment in src/main/resources/META-INF/spring/batch/override/servlet-context.xml

Job

Should be located in classpath*:/META-INF/spring/jobs/*.xml one file per job is recommended

Scheduler

You can use Quartz but Spring > 3.0.2 offer a scheduler. Do not mix job and scheduler in the same file r you may have 2 instances of scheduler bean running at the same time in UI and in spring context, you can see the tricks in web.xml.

official samples are at https://github.com/spring-projects/spring-batch/tree/master/spring-batch-samples

spring-batch-sample's People

Contributors

cedricwalter avatar

Watchers

 avatar  avatar

Forkers

lonsonlee

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.