GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - naver/spring-batch-plus: Add useful features to spring batch

BranchesTags
Open more actions menu

Latest commit

 

History

390 Commits
390 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
buildSrc
buildSrc
 
 
doc
doc
 
 
gradle
gradle
 
 
scripts
scripts
 
 
spring-batch-plus-kotlin
spring-batch-plus-kotlin
 
 
spring-batch-plus-sample
spring-batch-plus-sample
 
 
spring-batch-plus
spring-batch-plus
 
 
spring-boot-autoconfigure-batch-plus-kotlin
spring-boot-autoconfigure-batch-plus-kotlin
 
 
spring-boot-autoconfigure-batch-plus
spring-boot-autoconfigure-batch-plus
 
 
spring-boot-starter-batch-plus-kotlin
spring-boot-starter-batch-plus-kotlin
 
 
spring-boot-starter-batch-plus
spring-boot-starter-batch-plus
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
RELEASE_PROCESS.md
RELEASE_PROCESS.md
 
 
build.gradle.kts
build.gradle.kts
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle.kts
settings.gradle.kts
 
 

Repository files navigation

Spring Batch Plus

maven central version build coverage license

Spring Batch Plus provides extension features to Spring Batch.

Features

Kotlin DSL

@Bean
fun testJob(batch: BatchDsl): Job =
    batch {
        job("testJob") {
            step("jobStep1") {
                jobBean("subJob1")
            }
            step("jobStep2") {
                jobBean("subJob2")
            }
        }
    }

@Bean
fun subJob1(batch: BatchDsl, transactionManager: PlatformTransactionManager): Job =
    batch {
        job("subJob1") {
            step("testStep1") {
                tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager)
            }
        }
    }

@Bean
fun subJob2(batch: BatchDsl, transactionManager: PlatformTransactionManager): Job =
    batch {
        job("subJob2") {
            step("testStep2") {
                tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager)
            }
        }
    }

Single class reader-processor-writer

  • ItemStreamFluxReaderProcessorWriter
  • ItemStreamIterableReaderProcessorWriter
  • ItemStreamIterableReaderProcessorWriter
  • ItemStreamSimpleReaderProcessorWriter
// single class
@Component
@StepScope
class SampleTasklet : ItemStreamFluxReaderProcessorWriter<Int, String> {
    private var count = 0

    override fun readFlux(executionContext: ExecutionContext): Flux<out Int> {
        return Flux.generate { sink ->
            if (count < 20) {
                sink.next(count)
                ++count
            } else {
                sink.complete()
            }
        }
    }

    override fun process(item: Int): String? {
        return "'$item'"
    }

    override fun write(chunk: Chunk<String>) {
        println(chunk.items)
    }
}

// usage
@Bean
fun testJob(
    sampleTasklet: SampleTasklet,
    batch: BatchDsl,
    transactionManager: PlatformTransactionManager,
): Job =
    batch {
        job("testJob") {
            step("testStep") {
                chunk<Int, String>(3) {
                    transactionManager(transactionManager)
                    reader(sampleTasklet.asItemStreamReader())
                    processor(sampleTasklet.asItemProcessor())
                    writer(sampleTasklet.asItemStreamWriter())
                }
            }
        }
    }

Other Useful Classes

  • ClearRunIdIncrementer
  • DeleteMetadataJob

Compatibility

We've tested following versions only. Other versions may not work.

Batch Plus (Latest) Batch Boot Starter Kotlin Java Status Samples
2.0.x (2.0.1) 6.0.x 4.0.x ~ 4.1.x 2.2 or higher 17 or higher Maintained Samples
1.2.x (1.2.0) 5.2.x 3.4.x ~ 3.5.x 1.6 or higher 17 or higher Maintained Samples
1.1.x (1.1.0) 5.1.x 3.2.x ~ 3.3.x 1.5 or higher 17 or higher Maintained Samples
1.0.x (1.0.1) 5.0.x 3.0.x ~ 3.1.x 1.5 or higher 17 or higher Maintained Samples
0.3.x (0.3.1) 4.3.x 2.4.x ~ 2.7.x 1.5 or higher 1.8 or higher Maintained Samples
0.2.x (0.2.0) 4.3.x 2.4.x ~ 2.7.x 1.5 or higher 1.8 or higher Freezed Samples
0.1.x (0.1.0) 4.3.x 2.4.x ~ 2.7.x 1.5 or higher 1.8 or higher Freezed Samples

Download

Since it provides extension features to spring batch, need to used with spring batch.

Gradle

Kotlin

implementation("org.springframework.boot:spring-boot-starter-batch:${springBootVersion}") // need spring batch
implementation("com.navercorp.spring:spring-boot-starter-batch-plus-kotlin:${springBatchPlusVersion}")

Java

implementation("org.springframework.boot:spring-boot-starter-batch:${springBootVersion}") // need spring batch
implementation("com.navercorp.spring:spring-boot-starter-batch-plus:${springBatchPlusVersion}")

Maven

Kotlin

<!-- need spring batch -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-batch</artifactId>
    <version>{springBootVersion}</version>
</dependency>
<dependency>
    <groupId>com.navercorp.spring</groupId>
    <artifactId>spring-boot-starter-batch-plus-kotlin</artifactId>
    <version>{springBatchPlusVersion}</version>
</dependency>

Java

<!-- need spring batch -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-batch</artifactId>
    <version>{springBootVersion}</version>
</dependency>
<dependency>
    <groupId>com.navercorp.spring</groupId>
    <artifactId>spring-boot-starter-batch-plus</artifactId>
    <version>{springBatchPlusVersion}</version>
</dependency>

User Guide

  • 2.0.x
    • Korean
    • English
  • 1.2.x
    • Korean
    • English
  • 1.1.x
    • Korean
    • English
  • 1.0.x
    • Korean
    • English
  • 0.3.x
    • Korean
    • English

Build from source

Prerequisites

  • Jdk 17 or higher

Build

  • Clean: ./gradlew clean
  • Check: ./gradlew check
    • Coverage report will be generated in ${project}/build/jacoco/html/index.html
  • Assemble: ./gradlew build
  • Install to local: ./gradlew install
  • Publish: ./gradlew publish --no-parallel

License

   Copyright (c) 2022-present NAVER Corp.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

About

Add useful features to spring batch

Topics

dsljavakotlinkotlin-dslspring-batch

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

130 stars

Watchers

4 watching

Forks

10 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.