From 8133ddb0c312305cb257c0a531d8cb5575574a8b Mon Sep 17 00:00:00 2001 From: Taeik Lim Date: Fri, 7 Feb 2025 00:19:01 +0900 Subject: [PATCH] Remove jobrepository dsl sample & doc It's deprecated in spring batch itself Signed-off-by: Taeik Lim --- .../kotlin-dsl/job/job-configuration.md | 31 ----------- .../kotlin-dsl/step/step-configuration.md | 32 ----------- .../kotlin-dsl/job/job-configuration.md | 31 ----------- .../kotlin-dsl/step/step-configuration.md | 32 ----------- .../repository/SampleApplicationTest.kt | 45 ---------------- .../configuration/repository/TestJobConfig.kt | 52 ------------------ .../repository/SampleApplicationTest.kt | 45 ---------------- .../configuration/repository/TestJobConfig.kt | 53 ------------------- 8 files changed, 321 deletions(-) delete mode 100644 spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/SampleApplicationTest.kt delete mode 100644 spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/TestJobConfig.kt delete mode 100644 spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/SampleApplicationTest.kt delete mode 100644 spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/TestJobConfig.kt diff --git a/doc/en/configuration/kotlin-dsl/job/job-configuration.md b/doc/en/configuration/kotlin-dsl/job/job-configuration.md index db887046..13f347b4 100644 --- a/doc/en/configuration/kotlin-dsl/job/job-configuration.md +++ b/doc/en/configuration/kotlin-dsl/job/job-configuration.md @@ -8,7 +8,6 @@ - [Set a BatchJobObservationConvention](#set-a-batchjobobservationconvention) - [Set a ObservationRegistry](#set-a-observationregistry) - [Set preventRestart](#set-preventrestart) -- [Set a Repository](#set-a-repository) - [Set a JobParametersValidator](#set-a-jobparametersvalidator) The functions that can be set with `JobBuilder` are also available with the Kotlin DSL. In this page, you will learn how to set a `Job` using the Kotlin DSL. @@ -246,36 +245,6 @@ open class TestJobConfig( } ``` -## Set a Repository - -The Kotlin DSL helps you set a `JobRepository` using `JobBuilder`. - -```kotlin -@Configuration -open class TestJobConfig( - private val batch: BatchDsl, - private val transactionManager: PlatformTransactionManager, -) { - - @Bean - open fun testJob(jobRepository: JobRepository): Job = batch { - job("testJob") { - repository( - object : JobRepository by jobRepository { - override fun update(jobExecution: JobExecution) { - println("update jobExecution to $jobExecution") - jobRepository.update(jobExecution) - } - }, - ) - step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - } - } - } -} -``` - ## Set a JobParametersValidator The Kotlin DSL helps you set a `JobParametersValidator` using `JobBuilder`. diff --git a/doc/en/configuration/kotlin-dsl/step/step-configuration.md b/doc/en/configuration/kotlin-dsl/step/step-configuration.md index 5ef9fabe..84050af7 100644 --- a/doc/en/configuration/kotlin-dsl/step/step-configuration.md +++ b/doc/en/configuration/kotlin-dsl/step/step-configuration.md @@ -1,6 +1,5 @@ # Step Configuration -- [Set a job repository](#set-a-job-repository) - [Set a BatchStepObservationConvention](#set-a-batchstepobservationconvention) - [Set a ObservationRegistry](#set-a-observationregistry) - [Set a MeterRegistry](#set-a-meterregistry) @@ -12,37 +11,6 @@ The functions that can be set with `StepBuilder` are also available with the Kotlin DSL. In this page, you will learn how to configure a `Step` using the Kotlin DSL. -## Set a job repository - -The Kotlin DSL helps you set a `JobRepository` using `StepBuilder`. - -```kotlin -@Configuration -open class TestJobConfig( - private val batch: BatchDsl, - private val transactionManager: PlatformTransactionManager, - private val jobRepository: JobRepository, -) { - - @Bean - open fun testJob(): Job = batch { - job("testJob") { - step("testStep") { - repository( - object : JobRepository by jobRepository { - override fun update(stepExecution: StepExecution) { - println("update stepExecution to $stepExecution") - jobRepository.update(stepExecution) - } - }, - ) - tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - } - } - } -} -``` - ## Set a BatchStepObservationConvention The Kotlin DSL helps you set a `BatchStepObservationConvention` using `StepBuilder`. diff --git a/doc/ko/configuration/kotlin-dsl/job/job-configuration.md b/doc/ko/configuration/kotlin-dsl/job/job-configuration.md index 37ab524f..9c1d6dd8 100644 --- a/doc/ko/configuration/kotlin-dsl/job/job-configuration.md +++ b/doc/ko/configuration/kotlin-dsl/job/job-configuration.md @@ -8,7 +8,6 @@ - [BatchJobObservationConvention 설정하기](#batchjobobservationconvention-설정하기) - [ObservationRegistry 설정하기](#observationregistry-설정하기) - [PreventRestart 설정하기](#preventrestart-설정하기) -- [Repository 설정하기](#repository-설정하기) - [JobParametersValidator 설정하기](#jobparametersvalidator-설정하기) Kotlin DSL은 `JobBuilder`에서 설정할 수 있는 기능을 모두 제공합니다. 이 문서에서는 Kotlin DSL을 활용해서 `Job` 을 설정하는 방법에 대해서 다룹니다. @@ -247,36 +246,6 @@ open class TestJobConfig( } ``` -## Repository 설정하기 - -Kotlin DSL은 `JobBuilder`를 사용해서 `JobRepository` 설정을 하는 방법을 제공합니다. - -```kotlin -@Configuration -open class TestJobConfig( - private val batch: BatchDsl, - private val transactionManager: PlatformTransactionManager, -) { - - @Bean - open fun testJob(jobRepository: JobRepository): Job = batch { - job("testJob") { - repository( - object : JobRepository by jobRepository { - override fun update(jobExecution: JobExecution) { - println("update jobExecution to $jobExecution") - jobRepository.update(jobExecution) - } - }, - ) - step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - } - } - } -} -``` - ## JobParametersValidator 설정하기 Kotlin DSL은 `JobBuilder`를 사용해서 `JobParametersValidator` 설정을 하는 방법을 제공합니다. diff --git a/doc/ko/configuration/kotlin-dsl/step/step-configuration.md b/doc/ko/configuration/kotlin-dsl/step/step-configuration.md index cf19db5e..2557ed58 100644 --- a/doc/ko/configuration/kotlin-dsl/step/step-configuration.md +++ b/doc/ko/configuration/kotlin-dsl/step/step-configuration.md @@ -1,6 +1,5 @@ # Step Configuration -- [Job Repository 설정](#job-repository-설정) - [BatchStepObservationConvention 설정](#batchstepobservationconvention-설정) - [ObservationRegistry 설정](#observationregistry-설정) - [MeterRegistry 설정](#meterregistry-설정) @@ -12,37 +11,6 @@ Kotlin DSL에서는 `StepBuilder`에서 설정할 수 있는 기능을 모두 제공합니다. 이 문서에서는 Kotlin DSL을 활용해서 `Step` 관련 설정들을 하는 방법에 대해서 다룹니다. -## Job Repository 설정 - -Kotlin DSL은 `StepBuilder`를 사용하여 `JobRepository`를 설정하는 방법을 제공합니다. - -```kotlin -@Configuration -open class TestJobConfig( - private val batch: BatchDsl, - private val transactionManager: PlatformTransactionManager, - private val jobRepository: JobRepository, -) { - - @Bean - open fun testJob(): Job = batch { - job("testJob") { - step("testStep") { - repository( - object : JobRepository by jobRepository { - override fun update(stepExecution: StepExecution) { - println("update stepExecution to $stepExecution") - jobRepository.update(stepExecution) - } - }, - ) - tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - } - } - } -} -``` - ## BatchStepObservationConvention 설정 Kotlin DSL은 `StepBuilder`를 사용하여 `BatchStepObservationConvention`을 설정하는 방법을 제공합니다. diff --git a/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/SampleApplicationTest.kt b/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/SampleApplicationTest.kt deleted file mode 100644 index e209414f..00000000 --- a/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/SampleApplicationTest.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Spring Batch Plus - * - * Copyright 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. - */ - -package com.navercorp.spring.batch.plus.sample.job.configuration.repository - -import org.junit.jupiter.api.Test -import org.springframework.batch.core.BatchStatus -import org.springframework.batch.core.Job -import org.springframework.batch.core.JobParametersBuilder -import org.springframework.batch.core.launch.JobLauncher -import org.springframework.beans.factory.getBean -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.runApplication - -@SpringBootApplication -open class SampleApplicationTest { - @Test - fun run() { - val applicationContext = runApplication() - val jobLauncher = applicationContext.getBean() - val job = applicationContext.getBean() - - val jobParameters = JobParametersBuilder() - .toJobParameters() - val jobExecution = jobLauncher.run(job, jobParameters) - - assert(BatchStatus.COMPLETED == jobExecution.status) - println(jobExecution) - } -} diff --git a/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/TestJobConfig.kt b/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/TestJobConfig.kt deleted file mode 100644 index 9efa69b2..00000000 --- a/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/TestJobConfig.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Spring Batch Plus - * - * Copyright 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. - */ - -package com.navercorp.spring.batch.plus.sample.job.configuration.repository - -import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl -import org.springframework.batch.core.Job -import org.springframework.batch.core.JobExecution -import org.springframework.batch.core.repository.JobRepository -import org.springframework.batch.repeat.RepeatStatus -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.transaction.PlatformTransactionManager - -@Configuration -open class TestJobConfig( - private val batch: BatchDsl, - private val transactionManager: PlatformTransactionManager, -) { - - @Bean - open fun testJob(jobRepository: JobRepository): Job = batch { - job("testJob") { - repository( - object : JobRepository by jobRepository { - override fun update(jobExecution: JobExecution) { - println("update jobExecution to $jobExecution") - jobRepository.update(jobExecution) - } - }, - ) - step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - } - } - } -} diff --git a/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/SampleApplicationTest.kt b/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/SampleApplicationTest.kt deleted file mode 100644 index dc4fdfa3..00000000 --- a/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/SampleApplicationTest.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Spring Batch Plus - * - * Copyright 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. - */ - -package com.navercorp.spring.batch.plus.sample.step.configuration.repository - -import org.junit.jupiter.api.Test -import org.springframework.batch.core.BatchStatus -import org.springframework.batch.core.Job -import org.springframework.batch.core.JobParametersBuilder -import org.springframework.batch.core.launch.JobLauncher -import org.springframework.beans.factory.getBean -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.runApplication - -@SpringBootApplication -open class SampleApplicationTest { - @Test - fun run() { - val applicationContext = runApplication() - val jobLauncher = applicationContext.getBean() - val job = applicationContext.getBean() - - val jobParameters = JobParametersBuilder() - .toJobParameters() - val jobExecution = jobLauncher.run(job, jobParameters) - - assert(BatchStatus.COMPLETED == jobExecution.status) - println(jobExecution) - } -} diff --git a/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/TestJobConfig.kt b/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/TestJobConfig.kt deleted file mode 100644 index a73c1763..00000000 --- a/spring-batch-plus-sample/kotlin-dsl-sample/src/test/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/TestJobConfig.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Spring Batch Plus - * - * Copyright 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. - */ - -package com.navercorp.spring.batch.plus.sample.step.configuration.repository - -import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl -import org.springframework.batch.core.Job -import org.springframework.batch.core.StepExecution -import org.springframework.batch.core.repository.JobRepository -import org.springframework.batch.repeat.RepeatStatus -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.transaction.PlatformTransactionManager - -@Configuration -open class TestJobConfig( - private val batch: BatchDsl, - private val transactionManager: PlatformTransactionManager, - private val jobRepository: JobRepository, -) { - - @Bean - open fun testJob(): Job = batch { - job("testJob") { - step("testStep") { - repository( - object : JobRepository by jobRepository { - override fun update(stepExecution: StepExecution) { - println("update stepExecution to $stepExecution") - jobRepository.update(stepExecution) - } - }, - ) - tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - } - } - } -}