Announcement Announcement Module
No announcement yet.
How do I start - Any examples? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I start - Any examples?

    I was looking through the documentation and there does not seem to be an example how to use Spring batch. Can you point me in the direction of an example?


  • #2
    When you checkout the source code you will see "samples" module. There are several example jobs which you can run as junit tests (see the package org.springframework.batch.sample under src/test/java)


    • #3
      You can find a simple example in org.springframework.batch.sample.AbstractBatchLaun cherTests.

      Code less and config more.

      And it is said the interface JobLauncher will be removed soon(


      • #4
        JobLauncher is still there - probably will survive in 1.0 (I updated the JIRA issue comment to show this in case you aren't following the API).


        • #5
          problem in starting Sample Batch Job


          I got problem while running sample project which i got from following location:

          The problem i am facing right now is how to run the sample project, i import the project in eclipse and put all dependent libraries and then run main file i.e. QuartzBatchLauncher. The configuration files related to sample project i.e. data-source.xml, simple-container-definition.xml and others files are loaded successfully, but i am not getting a starting point in order to run any sample job xml file.
          Now anyone can help me and guide how to start run any job file.
          I reckon the information related to spring-batch especially the samples are scattered.


          • #6
            There is a JIRA issue open for someone to create a Getting Started Guide, so please be patient on the documentation.

            You probably should checkout the samples source code from SVN because the best demos are all actually JUnit tests at the moment (in package org.springframework.batch.sample), and those are not in the s3 maven repo for m2. The main() method you found is not maintained - has no unit tests, so I'm not surprised if it doesn't work. It will probably be removed in a later milestone.

            M3 will be out later this week and will include a .zip download of all sources so you won't need to use SVN.


            • #7
              ...but following on from my last post - you don't *need* to checkout the test sources, but you have picked the wrong main() method. BatchCommandLineLauncher is a simple launcher that you can use to run any of the samples. It has pretty full Javadocs. But it isn't in the samples project (it's in execution).


              • #8
                Dave, some months ago I attended a session from Joris which had a nice example/case/tutorial for Spring batch. Maybe that presentation can be included in the Spring Batch build (or put on the website?).