{"id":13733950,"url":"https://github.com/spring-projects/spring-batch","last_synced_at":"2025-05-12T03:39:54.763Z","repository":{"id":1186746,"uuid":"1089149","full_name":"spring-projects/spring-batch","owner":"spring-projects","description":"Spring Batch is a framework for writing batch applications using Java and Spring","archived":false,"fork":false,"pushed_at":"2025-05-07T22:17:18.000Z","size":105679,"stargazers_count":2804,"open_issues_count":328,"forks_count":2399,"subscribers_count":234,"default_branch":"main","last_synced_at":"2025-05-08T14:15:46.880Z","etag":null,"topics":["batch","batch-processing","java","spring"],"latest_commit_sha":null,"homepage":"http://projects.spring.io/spring-batch/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spring-projects.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2010-11-17T17:53:45.000Z","updated_at":"2025-05-07T22:17:23.000Z","dependencies_parsed_at":"2023-02-12T03:31:17.926Z","dependency_job_id":"ea7769a9-4c98-438d-8058-0be24f57f336","html_url":"https://github.com/spring-projects/spring-batch","commit_stats":{"total_commits":6365,"total_committers":257,"mean_commits":"24.766536964980546","dds":0.6538884524744697,"last_synced_commit":"fc1f3fcfc791196273b1249157c4e860b1df9025"},"previous_names":[],"tags_count":151,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-projects%2Fspring-batch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-projects%2Fspring-batch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-projects%2Fspring-batch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring-projects%2Fspring-batch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spring-projects","download_url":"https://codeload.github.com/spring-projects/spring-batch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253669497,"owners_count":21945106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch","batch-processing","java","spring"],"created_at":"2024-08-03T03:00:51.223Z","updated_at":"2025-05-12T03:39:54.739Z","avatar_url":"https://github.com/spring-projects.png","language":"Java","readme":"# Latest news\n\n* March 19, 2025: [Spring Batch 5.2.2 available now](https://spring.io/blog/2025/03/19/spring-batch-5-2-2-available-now) \n* December 18, 2024: [Spring Batch 5.1.3 and 5.2.1 available now](https://spring.io/blog/2024/12/18/spring-batch-5-1-3-and-5-2-1-available-now) \n* November 24, 2024: [Bootiful Spring Boot 3.4: Spring Batch](https://spring.io/blog/2024/11/24/bootiful-34-batch) \n* November 20, 2024: [Spring Batch 5.2.0 goes GA!](https://spring.io/blog/2024/11/20/spring-batch-5-2-0-goes-ga)\n\n\u003cimg align=\"right\" src=\"spring-batch-docs/modules/ROOT/assets/images/spring-batch.png\" width=\"200\" height=\"200\"\u003e\n\n# Spring Batch [![build status](https://github.com/spring-projects/spring-batch/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/spring-projects/spring-batch/actions/workflows/continuous-integration.yml)\n\nSpring Batch is a lightweight, comprehensive batch framework designed to enable the development of robust batch applications vital for the daily operations of enterprise systems.  Spring Batch builds upon the productivity, POJO-based development approach, and general ease of use capabilities people have come to know from the [Spring Framework](https://github.com/spring-projects/spring-framework), while making it easy for developers to access and leverage more advanced enterprise services when necessary.\n\nIf you are looking for a runtime orchestration tool for your Batch applications, or need a management console to view current and historic executions, take a look at [Spring Cloud Data Flow](https://cloud.spring.io/spring-cloud-dataflow/).  It is an orchestration tool for deploying and executing data integration based microservices including Spring Batch applications.\n\n# Getting Started\n\n## Two minutes tutorial\n\nThis quick tutorial shows you how to setup a minimal project to run a simple batch job with Spring Batch.\n\nIn your favorite IDE, create a new Maven-based Java 17+ project and add the following dependencies:\n\n```xml\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.springframework.batch\u003c/groupId\u003e\n        \u003cartifactId\u003espring-batch-core\u003c/artifactId\u003e\n        \u003cversion\u003e${LATEST_VERSION}\u003c/version\u003e\n    \u003c/dependency\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.hsqldb\u003c/groupId\u003e\n        \u003cartifactId\u003ehsqldb\u003c/artifactId\u003e\n        \u003cversion\u003e${LATEST_VERSION}\u003c/version\u003e\n        \u003cscope\u003eruntime\u003c/scope\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\nThen, create a configuration class to define the datasource and transaction manager that will be used by the job repository:\n\n```java\nimport javax.sql.DataSource;\n\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.jdbc.support.JdbcTransactionManager;\nimport org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;\n\n@Configuration\npublic class DataSourceConfiguration {\n\n\t@Bean\n\tpublic DataSource dataSource() {\n\t\treturn new EmbeddedDatabaseBuilder()\n\t\t\t.addScript(\"/org/springframework/batch/core/schema-hsqldb.sql\")\n\t\t\t.build();\n\t}\n\n\t@Bean\n\tpublic JdbcTransactionManager transactionManager(DataSource dataSource) {\n\t\treturn new JdbcTransactionManager(dataSource);\n\t}\n\n}\n```\n\nIn this tutorial, an embedded [HSQLDB](http://www.hsqldb.org) database is created and initialized with Spring Batch's meta-data tables.\n\nFinally, create a class to define the batch job:\n\n```java\nimport org.springframework.batch.core.Job;\nimport org.springframework.batch.core.JobParameters;\nimport org.springframework.batch.core.Step;\nimport org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;\nimport org.springframework.batch.core.job.builder.JobBuilder;\nimport org.springframework.batch.core.launch.JobLauncher;\nimport org.springframework.batch.core.repository.JobRepository;\nimport org.springframework.batch.core.step.builder.StepBuilder;\nimport org.springframework.batch.repeat.RepeatStatus;\nimport org.springframework.context.ApplicationContext;\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.context.annotation.Import;\nimport org.springframework.jdbc.support.JdbcTransactionManager;\n\n@Configuration\n@EnableBatchProcessing\n@Import(DataSourceConfiguration.class)\npublic class HelloWorldJobConfiguration {\n\n\t@Bean\n\tpublic Step step(JobRepository jobRepository, JdbcTransactionManager transactionManager) {\n\t\treturn new StepBuilder(\"step\", jobRepository).tasklet((contribution, chunkContext) -\u003e {\n\t\t\tSystem.out.println(\"Hello world!\");\n\t\t\treturn RepeatStatus.FINISHED;\n\t\t}, transactionManager).build();\n\t}\n\n\t@Bean\n\tpublic Job job(JobRepository jobRepository, Step step) {\n\t\treturn new JobBuilder(\"job\", jobRepository).start(step).build();\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tApplicationContext context = new AnnotationConfigApplicationContext(HelloWorldJobConfiguration.class);\n\t\tJobLauncher jobLauncher = context.getBean(JobLauncher.class);\n\t\tJob job = context.getBean(Job.class);\n\t\tjobLauncher.run(job, new JobParameters());\n\t}\n\n}\n```\n\nThe job in this tutorial is composed of a single step that prints \"Hello world!\" to the standard output.\n\nYou can now run the `main` method of the `HelloWorldJobConfiguration` class to launch the job. The output should be similar to the following:\n\n```\nINFO: Finished Spring Batch infrastructure beans configuration in 8 ms.\nINFO: Starting embedded database: url='jdbc:hsqldb:mem:testdb', username='sa'\nINFO: No database type set, using meta data indicating: HSQL\nINFO: No Micrometer observation registry found, defaulting to ObservationRegistry.NOOP\nINFO: No TaskExecutor has been set, defaulting to synchronous executor.\nINFO: Job: [SimpleJob: [name=job]] launched with the following parameters: [{}]\nINFO: Executing step: [step]\nHello world!\nINFO: Step: [step] executed in 10ms\nINFO: Job: [SimpleJob: [name=job]] completed with the following parameters: [{}] and the following status: [COMPLETED] in 25ms\n```\n\n## Getting Started Guide\n\nThis guide is a more realistic tutorial that shows a typical ETL batch job that reads data from a flat file, transforms it and writes it to a relational database.\nIt is a Spring Batch project based on Spring Boot. You find the Getting Started Guide here: [Creating a Batch Service](https://spring.io/guides/gs/batch-processing/).\n\n## Samples\n\nYou can find several samples to try out here: [Spring Batch Samples](https://github.com/spring-projects/spring-batch/tree/main/spring-batch-samples).\n\n# Getting Help\n\nIf you have a question or a support request, please open a new discussion on [GitHub Discussions](https://github.com/spring-projects/spring-batch/discussions)\nor ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/spring-batch).\n\nPlease do **not** create issues on the [Issue Tracker](https://github.com/spring-projects/spring-batch/issues) for questions or support requests.\nWe would like to keep the issue tracker **exclusively** for bug reports and feature requests.\n\n# Reporting issues\n\nSpring Batch uses [GitHub Issues](https://github.com/spring-projects/spring-batch/issues) to record bugs and feature requests. If you want to raise an issue, please follow the recommendations below:\n\n* Before you open an issue, please search the issue tracker to see if someone has already reported the problem. If the issue doesn't already exist, create a new issue.\n* Please provide as much information as possible in the issue report by following the [Issue Reporting Template](https://github.com/spring-projects/spring-batch/blob/main/.github/ISSUE_TEMPLATE/bug_report.md).\n* If you need to paste code or include a stack trace, please use Markdown escapes (```) before and after your text.\n\nFor non trivial bugs, please create a test case or a project that replicates the problem and attach it to the issue, as detailed in the [Issue Reporting Guidelines](https://github.com/spring-projects/spring-batch/blob/main/ISSUE_REPORTING.md).\n\n# Reporting Security Vulnerabilities\n\nPlease see our [Security policy](https://github.com/spring-projects/spring-batch/security/policy).\n\n# Building from Source\n\n## Using the Command Line\n\nClone the git repository using the URL on the Github home page:\n\n    $ git clone git@github.com:spring-projects/spring-batch.git\n    $ cd spring-batch\n\nMaven is the build tool used for Spring Batch. You can build the project with the following command:\n\n    $ ./mvnw package\n\nIf you want to perform a full build with all integration tests, then run:\n\n    $ ./mvnw verify\n\nPlease note that some integration tests are based on Docker, so please make sure to have Docker up and running before running a full build.\n\nTo generate the reference documentation, run the following commands:\n\n```\n$ cd spring-batch-docs\n$ ../mvnw antora:antora\n```\n\nThe reference documentation can be found in `spring-batch-docs/target/anotra/site`.\n\n## Using Docker\n\nIf you want to build the project in a Docker container, you can proceed as follows:\n\n```\n$\u003e docker run -it --mount type=bind,source=\"$(pwd)\",target=/spring-batch maven:3-openjdk-17 bash\n#\u003e cd spring-batch\n#\u003e ./mvnw package\n```\n\nThis will mount the source code that you cloned previously on the host inside the container.\nIf you want to work on a copy of the source code inside the container (no side effects on the host),\nyou can proceed as follows:\n\n```\n$\u003e docker run -it maven:3-openjdk-17 bash\n#\u003e git clone https://github.com/spring-projects/spring-batch.git\n#\u003e cd spring-batch\n#\u003e ./mvnw package\n```\n\n# Contributing to Spring Batch\n\nWe welcome contributions in any kind! Here are some ways for you to contribute to the project:\n\n* Get involved with the Spring Batch community on [Twitter](https://twitter.com/springbatch), [GitHub Discussions](https://github.com/spring-projects/spring-batch/discussions) and [StackOverflow](https://stackoverflow.com/questions/tagged/spring-batch) by responding to questions and joining the debate.\n* Create [issues](https://github.com/spring-projects/spring-batch/issues) for bugs and new features or comment and vote on the ones that you are interested in.\n* Help us reproduce issues marked with [status: need-help-to-reproduce](https://github.com/spring-projects/spring-batch/labels/status%3A%20need-help-to-reproduce) by following the [Issue Reporting Guidelines](https://github.com/spring-projects/spring-batch/blob/main/ISSUE_REPORTING.md).\n* Github is for social coding: if you want to write code, we encourage contributions through pull requests. If you want to contribute code this way, please familiarize yourself with the process outlined here: [Contributor Guidelines](https://github.com/spring-projects/spring-batch/blob/main/CONTRIBUTING.md).\n* Watch for Spring Batch related articles on [spring.io](https://spring.io).\n\nBefore we accept pull requests, we will need you to sign the [contributor's agreement](https://support.springsource.com/spring_committer_signup).  Signing the contributor's agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do.  Active contributors might be asked to join the core team, and given the ability to merge pull requests.\n\n# Code of Conduct\n\nPlease see our [code of conduct](https://github.com/spring-projects/.github/blob/main/CODE_OF_CONDUCT.md).\n\n# License\n\nSpring Batch is Open Source software released under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0.html).\n","funding_links":[],"categories":["I. Development","批处理框架"],"sub_categories":["1. Common frameworks and libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspring-projects%2Fspring-batch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspring-projects%2Fspring-batch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspring-projects%2Fspring-batch/lists"}