diff --git a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/clear/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/clear/TestJobConfig.kt index 00359d72..23801c2d 100644 --- a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/clear/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/clear/TestJobConfig.kt @@ -22,23 +22,24 @@ import com.navercorp.spring.batch.plus.job.ClearRunIdIncrementer import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { incrementer(ClearRunIdIncrementer.create()) step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/clearwithid/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/clearwithid/TestJobConfig.kt index 8f16d068..b82c442c 100644 --- a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/clearwithid/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/clearwithid/TestJobConfig.kt @@ -22,23 +22,24 @@ import com.navercorp.spring.batch.plus.job.ClearRunIdIncrementer import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { incrementer(ClearRunIdIncrementer.create("testId")) step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/clear/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/clear/TestJobConfig.java index a7a04f28..690dde08 100644 --- a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/clear/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/clear/TestJobConfig.java @@ -23,9 +23,9 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.ClearRunIdIncrementer; @@ -34,7 +34,8 @@ public class TestJobConfig { @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(ClearRunIdIncrementer.create()) @@ -42,7 +43,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/clearwithid/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/clearwithid/TestJobConfig.java index 1b9e20b5..dcd3a945 100644 --- a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/clearwithid/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/clearwithid/TestJobConfig.java @@ -23,9 +23,9 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.ClearRunIdIncrementer; @@ -34,7 +34,8 @@ public class TestJobConfig { @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(ClearRunIdIncrementer.create("testId")) @@ -42,7 +43,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/comparison/bad/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/comparison/bad/TestJobConfig.java index ff4504de..209a5d81 100644 --- a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/comparison/bad/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/comparison/bad/TestJobConfig.java @@ -27,17 +27,18 @@ import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; @Configuration public class TestJobConfig { @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(new RunIdIncrementer()) @@ -45,7 +46,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( testTasklet(null, null), - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/comparison/good/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/comparison/good/TestJobConfig.java index f4205a80..575816bb 100644 --- a/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/comparison/good/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-clear-run-id-incrementer/src/main/java/com/navecorp/spring/batch/plus/sample/comparison/good/TestJobConfig.java @@ -26,10 +26,10 @@ import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.ClearRunIdIncrementer; @@ -38,7 +38,8 @@ public class TestJobConfig { @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(ClearRunIdIncrementer.create()) // use ClearRunIdIncrementer @@ -46,7 +47,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( testTasklet(null, null), - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/customdryrun/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/customdryrun/TestJobConfig.kt index 919500c8..4017317f 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/customdryrun/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/customdryrun/TestJobConfig.kt @@ -23,14 +23,17 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.boot.autoconfigure.batch.BatchDataSource import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import javax.sql.DataSource @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun removeJob( @@ -44,14 +47,12 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/dryrun/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/dryrun/TestJobConfig.kt index c0dca3e6..dbb0cb27 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/dryrun/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/dryrun/TestJobConfig.kt @@ -23,14 +23,17 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.boot.autoconfigure.batch.BatchDataSource import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import javax.sql.DataSource @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun removeJob( @@ -43,14 +46,12 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/formatter/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/formatter/TestJobConfig.kt index e577c1d0..80071b57 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/formatter/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/formatter/TestJobConfig.kt @@ -23,15 +23,18 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.boot.autoconfigure.batch.BatchDataSource import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import java.time.format.DateTimeFormatter import javax.sql.DataSource @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun removeJob( @@ -45,14 +48,12 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/jobname/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/jobname/TestJobConfig.kt index e879ef73..6734b7fa 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/jobname/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/jobname/TestJobConfig.kt @@ -23,14 +23,17 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.boot.autoconfigure.batch.BatchDataSource import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import javax.sql.DataSource @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun removeJob( @@ -43,14 +46,12 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/parametername/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/parametername/TestJobConfig.kt index ddf28ad7..2d5309f0 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/parametername/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/parametername/TestJobConfig.kt @@ -23,14 +23,17 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.boot.autoconfigure.batch.BatchDataSource import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import javax.sql.DataSource @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun removeJob( @@ -44,14 +47,12 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/plain/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/plain/TestJobConfig.kt index c60892fb..a21c0f73 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/plain/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/plain/TestJobConfig.kt @@ -23,14 +23,17 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.boot.autoconfigure.batch.BatchDataSource import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import javax.sql.DataSource @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun deleteMetadataJob( @@ -42,14 +45,12 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/prefix/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/prefix/TestJobConfig.kt index f6f6806e..23a9530c 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/prefix/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/prefix/TestJobConfig.kt @@ -23,14 +23,17 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.boot.autoconfigure.batch.BatchDataSource import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import javax.sql.DataSource @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun removeJob( @@ -44,14 +47,12 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/prefixfromvariable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/prefixfromvariable/TestJobConfig.kt index 2fe4b002..d2e40ac6 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/prefixfromvariable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/deletemedadata/prefixfromvariable/TestJobConfig.kt @@ -23,15 +23,18 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.boot.autoconfigure.batch.BatchDataSource import org.springframework.boot.autoconfigure.batch.BatchProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import javax.sql.DataSource @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun removeJob( @@ -47,14 +50,12 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { tasklet( { _, _ -> RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/customdryrun/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/customdryrun/TestJobConfig.java index e3e61813..15e5a9ff 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/customdryrun/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/customdryrun/TestJobConfig.java @@ -26,10 +26,10 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.boot.autoconfigure.batch.BatchDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.metadata.DeleteMetadataJobBuilder; @@ -49,7 +49,8 @@ public Job removeJob( @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(new RunIdIncrementer()) @@ -57,7 +58,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/dryrun/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/dryrun/TestJobConfig.java index 8e4d22c2..07fabf56 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/dryrun/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/dryrun/TestJobConfig.java @@ -26,10 +26,10 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.boot.autoconfigure.batch.BatchDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.metadata.DeleteMetadataJobBuilder; @@ -48,7 +48,8 @@ public Job removeJob( @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(new RunIdIncrementer()) @@ -56,7 +57,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/formatter/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/formatter/TestJobConfig.java index dfc56602..1280eb02 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/formatter/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/formatter/TestJobConfig.java @@ -28,10 +28,10 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.boot.autoconfigure.batch.BatchDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.metadata.DeleteMetadataJobBuilder; @@ -51,7 +51,8 @@ public Job removeJob( @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(new RunIdIncrementer()) @@ -59,7 +60,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/jobname/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/jobname/TestJobConfig.java index 72f38982..7759bfa4 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/jobname/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/jobname/TestJobConfig.java @@ -26,10 +26,10 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.boot.autoconfigure.batch.BatchDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.metadata.DeleteMetadataJobBuilder; @@ -48,7 +48,8 @@ public Job removeJob( @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(new RunIdIncrementer()) @@ -56,7 +57,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/parametername/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/parametername/TestJobConfig.java index 2bb6cace..69ac98af 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/parametername/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/parametername/TestJobConfig.java @@ -26,10 +26,10 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.boot.autoconfigure.batch.BatchDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.metadata.DeleteMetadataJobBuilder; @@ -49,7 +49,8 @@ public Job removeJob( @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(new RunIdIncrementer()) @@ -57,7 +58,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/plain/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/plain/TestJobConfig.java index ed00d514..3cb568e2 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/plain/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/plain/TestJobConfig.java @@ -26,10 +26,10 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.boot.autoconfigure.batch.BatchDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.metadata.DeleteMetadataJobBuilder; @@ -47,7 +47,8 @@ public Job deleteMetadataJob( @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(new RunIdIncrementer()) @@ -55,7 +56,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/prefix/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/prefix/TestJobConfig.java index 0c257dd9..db72e76e 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/prefix/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/prefix/TestJobConfig.java @@ -26,10 +26,10 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.boot.autoconfigure.batch.BatchDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.metadata.DeleteMetadataJobBuilder; @@ -49,7 +49,8 @@ public Job removeJob( @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(new RunIdIncrementer()) @@ -57,7 +58,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/prefixfromvariable/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/prefixfromvariable/TestJobConfig.java index 83436283..a495943f 100644 --- a/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/prefixfromvariable/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-delete-meta-data-job/src/main/java/com/navecorp/spring/batch/plus/sample/deletemetadata/prefixfromvariable/TestJobConfig.java @@ -26,11 +26,11 @@ import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.boot.autoconfigure.batch.BatchDataSource; import org.springframework.boot.autoconfigure.batch.BatchProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; import com.navercorp.spring.batch.plus.job.metadata.DeleteMetadataJobBuilder; @@ -52,7 +52,8 @@ public Job removeJob( @Bean public Job testJob( - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .incrementer(new RunIdIncrementer()) @@ -60,7 +61,7 @@ public Job testJob( new StepBuilder("testStep", jobRepository) .tasklet( (contribution, chunkContext) -> RepeatStatus.FINISHED, - new ResourcelessTransactionManager() + transactionManager ) .build() ) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/comparision/after/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/comparision/after/TestJobConfig.kt index e2e6daf5..9771e449 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/comparision/after/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/comparision/after/TestJobConfig.kt @@ -20,32 +20,53 @@ package com.navercorp.spring.batch.plus.sample.comparision.after import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job +import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { - val transactionManager = ResourcelessTransactionManager() + open fun testJob(): Job = batch { job("testJob") { step("testStep1") { tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } - step("testStep2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - } - step("testStep3") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - } - step("testStep4") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + step(testStep2()) { + on("COMPLETED") { + step(testStep3()) + } + on("FAILED") { + step(testStep4()) + } } } } + + @Bean + open fun testStep2(): Step = batch { + step("testStep2") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + } + } + + @Bean + open fun testStep3(): Step = batch { + step("testStep3") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + } + } + + @Bean + open fun testStep4(): Step = batch { + step("testStep4") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + } + } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/comparision/before/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/comparision/before/TestJobConfig.kt index e965f555..b5908e8c 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/comparision/before/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/comparision/before/TestJobConfig.kt @@ -19,43 +19,55 @@ package com.navercorp.spring.batch.plus.sample.comparision.before import org.springframework.batch.core.Job +import org.springframework.batch.core.Step import org.springframework.batch.core.job.builder.JobBuilder import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.core.step.builder.StepBuilder import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val jobRepository: JobRepository, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - jobRepository: JobRepository, - ): Job { - val transactionManager = ResourcelessTransactionManager() + open fun testJob(): Job { return JobBuilder("testJob", jobRepository) .start( StepBuilder("testStep1", jobRepository) .tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) .build(), ) - .next( - StepBuilder("testStep2", jobRepository) - .tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - .build(), - ) - .next( - StepBuilder("testStep3", jobRepository) - .tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - .build(), - ) - .next( - StepBuilder("testStep4", jobRepository) - .tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) - .build(), - ) + .next(testStep2()) + .on("COMPLETED").to(testStep3()) + .from(testStep2()) + .on("FAILED").to(testStep4()) + .end() + .build() + } + + @Bean + open fun testStep2(): Step { + return StepBuilder("testStep2", jobRepository) + .tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + .build() + } + + @Bean + open fun testStep3(): Step { + return StepBuilder("testStep3", jobRepository) + .tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + .build() + } + + @Bean + open fun testStep4(): Step { + return StepBuilder("testStep4", jobRepository) + .tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) .build() } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/flow/creation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/flow/creation/TestJobConfig.kt index bc37d0bf..17f8933e 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/flow/creation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/flow/creation/TestJobConfig.kt @@ -23,13 +23,14 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -56,7 +57,7 @@ open class TestJobConfig( @Bean open fun testStep(): Step = batch { step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/incrementer/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/incrementer/TestJobConfig.kt index c74a58d5..6d743ab6 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/incrementer/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/incrementer/TestJobConfig.kt @@ -23,17 +23,18 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.JobParameters import org.springframework.batch.core.JobParametersBuilder import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { incrementer { val nextValue = it?.getLong("param")?.plus(1L) ?: 0L @@ -53,7 +54,7 @@ open class TestJobConfig { // } // ) step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/listener/annotation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/listener/annotation/TestJobConfig.kt index 70fda023..915c9af0 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/listener/annotation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/listener/annotation/TestJobConfig.kt @@ -23,12 +23,15 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.annotation.AfterJob import org.springframework.batch.core.annotation.BeforeJob import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { class TestListener { @BeforeJob @@ -43,13 +46,11 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { listener(TestListener()) step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/listener/object/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/listener/object/TestJobConfig.kt index c25042d7..9ce0e50a 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/listener/object/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/listener/object/TestJobConfig.kt @@ -23,17 +23,18 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.JobExecution import org.springframework.batch.core.JobExecutionListener import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { listener( object : JobExecutionListener { @@ -47,7 +48,7 @@ open class TestJobConfig { }, ) step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/meterregistry/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/meterregistry/TestJobConfig.kt index 6559df48..1ba0a0af 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/meterregistry/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/meterregistry/TestJobConfig.kt @@ -22,21 +22,22 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import io.micrometer.core.instrument.simple.SimpleMeterRegistry import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { meterRegistry(SimpleMeterRegistry()) step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/observationregistry/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/observationregistry/TestJobConfig.kt index 142e0df3..63f16461 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/observationregistry/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/observationregistry/TestJobConfig.kt @@ -22,21 +22,22 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import io.micrometer.observation.ObservationRegistry import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { observationRegistry(ObservationRegistry.create()) step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/preventrestart/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/preventrestart/TestJobConfig.kt index 0fad2f9e..b9d1231b 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/preventrestart/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/preventrestart/TestJobConfig.kt @@ -21,17 +21,18 @@ package com.navercorp.spring.batch.plus.sample.job.configuration.preventrestart import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { var isFirst = true job("testJob") { @@ -45,7 +46,7 @@ open class TestJobConfig { } RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/TestJobConfig.kt index cce0f0cc..9efa69b2 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/repository/TestJobConfig.kt @@ -23,18 +23,18 @@ 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.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - jobRepository: JobRepository, - ): Job = batch { + open fun testJob(jobRepository: JobRepository): Job = batch { job("testJob") { repository( object : JobRepository by jobRepository { @@ -45,7 +45,7 @@ open class TestJobConfig { }, ) step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/validator/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/validator/TestJobConfig.kt index eb179934..e66f545e 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/validator/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/configuration/validator/TestJobConfig.kt @@ -22,17 +22,18 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.JobParametersInvalidException import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { validator { val value = it?.getLong("param") @@ -52,7 +53,7 @@ open class TestJobConfig { // } // ) step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/creation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/creation/TestJobConfig.kt index 91662e3d..035a22c3 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/creation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/creation/TestJobConfig.kt @@ -21,23 +21,24 @@ package com.navercorp.spring.batch.plus.sample.job.creation import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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(): Job = batch { job("testJob") { step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } step("testStep2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/comparison/after/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/comparison/after/TestJobConfig.kt index 45fce2b9..6e1a7499 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/comparison/after/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/comparison/after/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -40,7 +41,7 @@ open class TestJobConfig( } on("FAILED") { step("failureStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { @@ -57,7 +58,7 @@ open class TestJobConfig( { _, _ -> throw IllegalStateException("step failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } @@ -65,7 +66,7 @@ open class TestJobConfig( @Bean open fun successStep(): Step = batch { step("successStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/comparison/before/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/comparison/before/TestJobConfig.kt index 8fd5a5f3..7491b843 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/comparison/before/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/comparison/before/TestJobConfig.kt @@ -24,13 +24,14 @@ import org.springframework.batch.core.job.builder.JobBuilder import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.core.step.builder.StepBuilder import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration open class TestJobConfig( private val jobRepository: JobRepository, + private val transactionManager: PlatformTransactionManager, ) { @Bean @@ -50,7 +51,7 @@ open class TestJobConfig( { _, _ -> throw IllegalStateException("step failed") }, - ResourcelessTransactionManager(), + transactionManager, ) .build() } @@ -58,14 +59,14 @@ open class TestJobConfig( @Bean open fun successStep(): Step { return StepBuilder("successStep", jobRepository) - .tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + .tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) .build() } @Bean open fun failureStep(): Step { return StepBuilder("failureStep", jobRepository) - .tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + .tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) .build() } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/decidertransition/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/decidertransition/bean/TestJobConfig.kt index ad391f17..afa3642d 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/decidertransition/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/decidertransition/bean/TestJobConfig.kt @@ -21,17 +21,18 @@ package com.navercorp.spring.batch.plus.sample.job.flow.decidertransition.bean import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { deciderBean("testDecider") { on("COMPLETED") { @@ -39,7 +40,7 @@ open class TestJobConfig { } on("FAILED") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/decidertransition/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/decidertransition/variable/TestJobConfig.kt index f0a7b398..8c94f62a 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/decidertransition/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/decidertransition/variable/TestJobConfig.kt @@ -23,17 +23,18 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.job.flow.FlowExecutionStatus import org.springframework.batch.core.job.flow.JobExecutionDecider import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { decider(testDecider()) { on("COMPLETED") { @@ -41,7 +42,7 @@ open class TestJobConfig { } on("FAILED") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/bean/TestJobConfig.kt index 29797648..80571e41 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/bean/TestJobConfig.kt @@ -22,17 +22,18 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { flowBean("testFlow1") flowBean("testFlow2") @@ -40,26 +41,22 @@ open class TestJobConfig { } @Bean - open fun testFlow1( - batch: BatchDsl, - ): Flow = batch { + open fun testFlow1(): Flow = batch { flow("testFlow1") { step("testFlow1Step1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } step("testFlow1Step2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @Bean - open fun testFlow2( - batch: BatchDsl, - ): Flow = batch { + open fun testFlow2(): Flow = batch { flow("testFlow2") { step("testFlow2Step1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/init/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/init/TestJobConfig.kt index 46d6882e..60a347cc 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/init/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/init/TestJobConfig.kt @@ -21,29 +21,30 @@ package com.navercorp.spring.batch.plus.sample.job.flow.flow.init import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { flow("testFlow1") { step("testFlow1Step1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } step("testFlow1Step2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } flow("testFlow2") { step("testFlow2Step1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/variable/TestJobConfig.kt index bdf61aa9..f97a90b1 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flow/variable/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -37,7 +38,7 @@ open class TestJobConfig( val testFlow3 = batch { flow("testFlow3") { step("testFlow3Step1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @@ -52,10 +53,10 @@ open class TestJobConfig( open fun testFlow1(): Flow = batch { flow("testFlow1") { step("testFlow1Step1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } step("testFlow1Step2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @@ -64,7 +65,7 @@ open class TestJobConfig( open fun testFlow2(): Flow = batch { flow("testFlow2") { step("testFlow2Step1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/bean/TestJobConfig.kt index 6a5878d1..e79daa04 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/bean/TestJobConfig.kt @@ -22,17 +22,18 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { flowBean("testFlow") { on("COMPLETED") { @@ -40,7 +41,7 @@ open class TestJobConfig { } on("FAILED") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { @@ -51,14 +52,12 @@ open class TestJobConfig { } @Bean - open fun testFlow( - batch: BatchDsl, - ): Flow = batch { + open fun testFlow(): Flow = batch { flow("testFlow") { step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/init/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/init/TestJobConfig.kt index 61648b23..de4fbc11 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/init/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/init/TestJobConfig.kt @@ -21,17 +21,18 @@ package com.navercorp.spring.batch.plus.sample.job.flow.flowtransition.init import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { flow( "testFlow", @@ -39,7 +40,7 @@ open class TestJobConfig { step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } }, @@ -49,7 +50,7 @@ open class TestJobConfig { } on("FAILED") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/variable/TestJobConfig.kt index 9b00cf43..a64c5045 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/flowtransition/variable/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -40,7 +41,7 @@ open class TestJobConfig( } on("FAILED") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { @@ -56,7 +57,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/bean/TestJobConfig.kt index 9cebc930..381e8a2c 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/bean/TestJobConfig.kt @@ -22,17 +22,18 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { stepBean("testStep1") stepBean("testStep2") @@ -41,29 +42,23 @@ open class TestJobConfig { } @Bean - open fun testStep1( - batch: BatchDsl, - ): Step = batch { + open fun testStep1(): Step = batch { step("testStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } @Bean - open fun testStep2( - batch: BatchDsl, - ): Step = batch { + open fun testStep2(): Step = batch { step("testStep2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } @Bean - open fun testStep3( - batch: BatchDsl, - ): Step = batch { + open fun testStep3(): Step = batch { step("testStep3") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/init/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/init/TestJobConfig.kt index f26f89c3..9b1e0aae 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/init/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/init/TestJobConfig.kt @@ -21,26 +21,27 @@ package com.navercorp.spring.batch.plus.sample.job.flow.step.init import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } step("testStep2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } step("testStep3") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/variable/TestJobConfig.kt index 37566ead..0f02d493 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/step/variable/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -36,7 +37,7 @@ open class TestJobConfig( job("testJob") { val testStep3 = batch { step("testStep3") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } @@ -49,14 +50,14 @@ open class TestJobConfig( @Bean open fun testStep1(): Step = batch { step("testStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } @Bean open fun testStep2(): Step = batch { step("testStep2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/bean/TestJobConfig.kt index a978ed01..eb7d3186 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/bean/TestJobConfig.kt @@ -22,17 +22,18 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { stepBean("testStep") { on("COMPLETED") { @@ -40,7 +41,7 @@ open class TestJobConfig { } on("FAILED") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { @@ -51,13 +52,11 @@ open class TestJobConfig { } @Bean - open fun testStep( - batch: BatchDsl, - ): Step = batch { + open fun testStep(): Step = batch { step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/init/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/init/TestJobConfig.kt index 1b756b5d..4022d9c6 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/init/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/init/TestJobConfig.kt @@ -21,24 +21,25 @@ package com.navercorp.spring.batch.plus.sample.job.flow.steptransition.init import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step( "testStep", { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) }, ) { @@ -47,7 +48,7 @@ open class TestJobConfig { } on("FAILED") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/variable/TestJobConfig.kt index 24bbc5f0..ba22c01d 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/steptransition/variable/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -40,7 +41,7 @@ open class TestJobConfig( } on("FAILED") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { @@ -55,7 +56,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/decider/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/decider/bean/TestJobConfig.kt index 32dec2d9..33161792 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/decider/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/decider/bean/TestJobConfig.kt @@ -24,13 +24,14 @@ import org.springframework.batch.core.Step import org.springframework.batch.core.job.flow.FlowExecutionStatus import org.springframework.batch.core.job.flow.JobExecutionDecider import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -65,7 +66,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } @@ -78,7 +79,7 @@ open class TestJobConfig( @Bean open fun transitionStep(): Step = batch { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/decider/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/decider/variable/TestJobConfig.kt index ee1a2ad2..d060e56b 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/decider/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/decider/variable/TestJobConfig.kt @@ -24,13 +24,14 @@ import org.springframework.batch.core.Step import org.springframework.batch.core.job.flow.FlowExecutionStatus import org.springframework.batch.core.job.flow.JobExecutionDecider import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -65,7 +66,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } @@ -78,7 +79,7 @@ open class TestJobConfig( @Bean open fun transitionStep(): Step = batch { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/end/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/end/TestJobConfig.kt index 4ab0d926..02971cf7 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/end/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/end/TestJobConfig.kt @@ -21,13 +21,14 @@ package com.navercorp.spring.batch.plus.sample.job.flow.transition.finish.end import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -52,7 +53,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/fail/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/fail/TestJobConfig.kt index dec94c55..16df90c1 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/fail/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/fail/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -48,7 +49,7 @@ open class TestJobConfig( @Bean open fun testStep(): Step = batch { step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/stop/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/stop/TestJobConfig.kt index d6980626..6afb31ae 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/stop/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/finish/stop/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -48,7 +49,7 @@ open class TestJobConfig( @Bean open fun testStep(): Step = batch { step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/bean/TestJobConfig.kt index 6f53c07d..b7ef99ef 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/bean/TestJobConfig.kt @@ -23,13 +23,14 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -54,7 +55,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } @@ -63,7 +64,7 @@ open class TestJobConfig( open fun transitionFlow(): Flow = batch { flow("transitionFlow") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/init/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/init/TestJobConfig.kt index 2ea4de7f..f313010e 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/init/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/init/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -41,7 +42,7 @@ open class TestJobConfig( on("FAILED") { flow("transitionFlow") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @@ -57,7 +58,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/nested/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/nested/TestJobConfig.kt index 37f3c672..72d240d2 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/nested/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/nested/TestJobConfig.kt @@ -23,13 +23,14 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -46,7 +47,7 @@ open class TestJobConfig( } on("*") { step("nestedStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @@ -63,7 +64,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } @@ -74,7 +75,7 @@ open class TestJobConfig( step("transitionStep") { tasklet( { _, _ -> throw IllegalStateException("transitionStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/variable/TestJobConfig.kt index c1eb4724..70068ba4 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/flow/variable/TestJobConfig.kt @@ -23,13 +23,14 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -54,7 +55,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } @@ -63,7 +64,7 @@ open class TestJobConfig( open fun transitionFlow(): Flow = batch { flow("transitionFlow") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/bean/TestJobConfig.kt index 7de6c3cd..a7b70527 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/bean/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -53,7 +54,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } @@ -61,7 +62,7 @@ open class TestJobConfig( @Bean open fun transitionStep(): Step = batch { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/init/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/init/TestJobConfig.kt index 9a856a39..8fe82746 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/init/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/init/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -40,7 +41,7 @@ open class TestJobConfig( } on("FAILED") { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { @@ -55,7 +56,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/nested/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/nested/TestJobConfig.kt index c41f8bc6..451b00e7 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/nested/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/nested/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -45,7 +46,7 @@ open class TestJobConfig( } on("*") { step("nestedStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @@ -62,7 +63,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } @@ -72,7 +73,7 @@ open class TestJobConfig( step("transitionStep") { tasklet( { _, _ -> throw IllegalStateException("transitionStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/variable/TestJobConfig.kt index 6f123049..c31babae 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/step/variable/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -53,7 +54,7 @@ open class TestJobConfig( step("testStep") { tasklet( { _, _ -> throw IllegalStateException("testStep failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } @@ -61,7 +62,7 @@ open class TestJobConfig( @Bean open fun transitionStep(): Step = batch { step("transitionStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/decider/BatchApplication.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/decider/BatchApplication.kt index 56b1acc2..51bcbd39 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/decider/BatchApplication.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/decider/BatchApplication.kt @@ -39,6 +39,6 @@ fun main() { val firstJobExecution = jobLauncher.run(job, jobParameters) val secondJobExecution = jobLauncher.run(job, jobParameters) - println("firstJobExecution: $firstJobExecution") - println("secondJobExecution: $secondJobExecution") + println("firstJobExecution: $firstJobExecution") // STOPPED + println("secondJobExecution: $secondJobExecution") // FAILED } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/decider/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/decider/TestJobConfig.kt index 038a9250..1f70e8f5 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/decider/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/decider/TestJobConfig.kt @@ -24,13 +24,14 @@ import org.springframework.batch.core.Step import org.springframework.batch.core.job.flow.FlowExecutionStatus import org.springframework.batch.core.job.flow.JobExecutionDecider import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -60,7 +61,7 @@ open class TestJobConfig( @Bean open fun testStep(): Step = batch { step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/flow/BatchApplication.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/flow/BatchApplication.kt index d3f6b8ae..a3e36e8e 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/flow/BatchApplication.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/flow/BatchApplication.kt @@ -39,6 +39,6 @@ fun main() { val firstJobExecution = jobLauncher.run(job, jobParameters) val secondJobExecution = jobLauncher.run(job, jobParameters) - println("firstJobExecution: $firstJobExecution") - println("secondJobExecution: $secondJobExecution") + println("firstJobExecution: $firstJobExecution") // STOPPED + println("secondJobExecution: $secondJobExecution") // COMPLETED } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/flow/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/flow/TestJobConfig.kt index 311b8f6a..6fcd16d3 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/flow/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/flow/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -39,7 +40,7 @@ open class TestJobConfig( stopAndRestartToFlow("restartFlow") { flow("restartFlow") { step("restartStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @@ -54,7 +55,7 @@ open class TestJobConfig( @Bean open fun testStep(): Step = batch { step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/step/BatchApplication.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/step/BatchApplication.kt index 8a058379..e8e6b90a 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/step/BatchApplication.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/step/BatchApplication.kt @@ -39,6 +39,6 @@ fun main() { val firstJobExecution = jobLauncher.run(job, jobParameters) val secondJobExecution = jobLauncher.run(job, jobParameters) - println("firstJobExecution: $firstJobExecution") - println("secondJobExecution: $secondJobExecution") + println("firstJobExecution: $firstJobExecution") // STOPPED + println("secondJobExecution: $secondJobExecution") // COMPLETED } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/step/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/step/TestJobConfig.kt index 8bb8fd8b..6b65fe3e 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/step/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/flow/transition/stopandrestart/step/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -37,7 +38,7 @@ open class TestJobConfig( step(testStep()) { on("COMPLETED") { stopAndRestartToStep("restartStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } on("*") { @@ -50,7 +51,7 @@ open class TestJobConfig( @Bean open fun testStep(): Step = batch { step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/bean/TestJobConfig.kt index e55fd33f..4b514c56 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/bean/TestJobConfig.kt @@ -22,18 +22,19 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { split(SimpleAsyncTaskExecutor()) { flowBean("testFlow1") @@ -44,34 +45,28 @@ open class TestJobConfig { } @Bean - open fun testFlow1( - batch: BatchDsl, - ): Flow = batch { + open fun testFlow1(): Flow = batch { flow("testFlow1") { step("testStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @Bean - open fun testFlow2( - batch: BatchDsl, - ): Flow = batch { + open fun testFlow2(): Flow = batch { flow("testFlow2") { step("testStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @Bean - open fun testFlow3( - batch: BatchDsl, - ): Flow = batch { + open fun testFlow3(): Flow = batch { flow("testFlow3") { step("testStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/init/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/init/TestJobConfig.kt index a0cb09ef..2e85b6d3 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/init/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/init/TestJobConfig.kt @@ -21,33 +21,34 @@ package com.navercorp.spring.batch.plus.sample.job.split.init import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { split(SimpleAsyncTaskExecutor()) { flow("testFlow1") { step("testStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } flow("testFlow2") { step("testStep2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } flow("testFlow3") { step("testStep3") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/variable/TestJobConfig.kt index a4367c71..e031be37 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/job/split/variable/TestJobConfig.kt @@ -22,14 +22,15 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration open class TestJobConfig( private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, ) { @Bean @@ -38,7 +39,7 @@ open class TestJobConfig( val testFlow3 = batch { flow("testFlow3") { step("testStep3") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @@ -54,7 +55,7 @@ open class TestJobConfig( open fun testFlow1(): Flow = batch { flow("testFlow1") { step("testStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } @@ -63,7 +64,7 @@ open class TestJobConfig( open fun testFlow2(): Flow = batch { flow("testFlow2") { step("testStep2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/chunkpolicy/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/chunkpolicy/TestJobConfig.kt index 97e0cb3d..3837a270 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/chunkpolicy/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/chunkpolicy/TestJobConfig.kt @@ -24,18 +24,21 @@ import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter import org.springframework.batch.repeat.policy.SimpleCompletionPolicy -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(SimpleCompletionPolicy(3), ResourcelessTransactionManager()) { + chunk(SimpleCompletionPolicy(3), transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/chunksize/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/chunksize/TestJobConfig.kt index 25d32ccd..8d3cfb9a 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/chunksize/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/chunksize/TestJobConfig.kt @@ -23,18 +23,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/chunklistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/chunklistener/TestJobConfig.kt index eed8e597..3fffe044 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/chunklistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/chunklistener/TestJobConfig.kt @@ -27,12 +27,15 @@ import org.springframework.batch.core.scope.context.ChunkContext import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { class TestListener { @BeforeChunk @@ -51,12 +54,10 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/mixed/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/mixed/TestJobConfig.kt index 781b43bd..562fe8c2 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/mixed/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/mixed/TestJobConfig.kt @@ -27,12 +27,15 @@ import org.springframework.batch.item.Chunk import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { class TestListener { @AfterRead @@ -52,12 +55,10 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/processorlistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/processorlistener/TestJobConfig.kt index 7e266ccc..1b56569a 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/processorlistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/processorlistener/TestJobConfig.kt @@ -26,12 +26,15 @@ import org.springframework.batch.core.annotation.OnProcessError import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { class TestListener { @BeforeProcess @@ -51,12 +54,10 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/readerlistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/readerlistener/TestJobConfig.kt index 9f13fbeb..09412cf7 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/readerlistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/readerlistener/TestJobConfig.kt @@ -26,12 +26,15 @@ import org.springframework.batch.core.annotation.OnReadError import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { class TestListener { @BeforeRead @@ -51,12 +54,10 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/writerlistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/writerlistener/TestJobConfig.kt index 4f726725..75dd3471 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/writerlistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/annotationlistener/writerlistener/TestJobConfig.kt @@ -27,12 +27,15 @@ import org.springframework.batch.item.Chunk import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { class TestListener { @BeforeWrite @@ -52,12 +55,10 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/chunklistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/chunklistener/TestJobConfig.kt index 46705a37..f96878ce 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/chunklistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/chunklistener/TestJobConfig.kt @@ -25,20 +25,21 @@ import org.springframework.batch.core.scope.context.ChunkContext import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/exceptionhandler/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/exceptionhandler/TestJobConfig.kt index 1a5d7a01..2473c6be 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/exceptionhandler/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/exceptionhandler/TestJobConfig.kt @@ -22,20 +22,21 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) writer(testItemWriter()) exceptionHandler { _, throwable -> diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/executor/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/executor/TestJobConfig.kt index 8d760f0b..38b0d4b7 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/executor/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/executor/TestJobConfig.kt @@ -22,14 +22,17 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor import org.springframework.core.task.TaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun customExecutor(): TaskExecutor { @@ -37,12 +40,10 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) writer(testItemWriter()) taskExecutor(customExecutor()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/processorlistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/processorlistener/TestJobConfig.kt index d1d827ec..bb3f05cc 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/processorlistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/processorlistener/TestJobConfig.kt @@ -24,20 +24,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/readerlistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/readerlistener/TestJobConfig.kt index 702d7318..2ef278c1 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/readerlistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/readerlistener/TestJobConfig.kt @@ -24,20 +24,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/stepoperation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/stepoperation/TestJobConfig.kt index d9b37a06..3539d94a 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/stepoperation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/stepoperation/TestJobConfig.kt @@ -26,20 +26,21 @@ import org.springframework.batch.repeat.RepeatCallback import org.springframework.batch.repeat.RepeatOperations import org.springframework.batch.repeat.RepeatStatus import org.springframework.batch.repeat.support.RepeatTemplate -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) writer(testItemWriter()) stepOperations( diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/stream/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/stream/TestJobConfig.kt index e04e63ff..dd1a34b1 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/stream/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/stream/TestJobConfig.kt @@ -25,20 +25,21 @@ import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemStream import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/transactionattribute/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/transactionattribute/TestJobConfig.kt index 7fa4ac4c..3b1e1e29 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/transactionattribute/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/transactionattribute/TestJobConfig.kt @@ -22,22 +22,23 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import org.springframework.transaction.interceptor.DefaultTransactionAttribute import org.springframework.transaction.support.TransactionSynchronizationManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) writer(testItemWriter()) transactionAttribute( diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/writerlistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/writerlistener/TestJobConfig.kt index 9b6a2176..0a6f61e8 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/writerlistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/config/writerlistener/TestJobConfig.kt @@ -25,20 +25,21 @@ import org.springframework.batch.item.Chunk import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/backoffpolicy/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/backoffpolicy/TestJobConfig.kt index 3a5e353d..07f8df34 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/backoffpolicy/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/backoffpolicy/TestJobConfig.kt @@ -23,21 +23,24 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.retry.RetryContext import org.springframework.retry.backoff.BackOffContext import org.springframework.retry.backoff.BackOffPolicy +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/keygenerator/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/keygenerator/TestJobConfig.kt index c51f0d16..50b26c1e 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/keygenerator/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/keygenerator/TestJobConfig.kt @@ -23,18 +23,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/noretry/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/noretry/TestJobConfig.kt index 9f18db9f..3df62524 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/noretry/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/noretry/TestJobConfig.kt @@ -23,18 +23,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/noskip/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/noskip/TestJobConfig.kt index 977a94f7..72bb95ba 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/noskip/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/noskip/TestJobConfig.kt @@ -23,18 +23,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/processornontx/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/processornontx/TestJobConfig.kt index 3bcf1733..d22ba606 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/processornontx/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/processornontx/TestJobConfig.kt @@ -23,18 +23,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retry/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retry/TestJobConfig.kt index ef06ce83..6c833749 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retry/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retry/TestJobConfig.kt @@ -23,18 +23,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrycontextcache/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrycontextcache/TestJobConfig.kt index 6b68ac14..5594c49d 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrycontextcache/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrycontextcache/TestJobConfig.kt @@ -23,19 +23,22 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.retry.policy.MapRetryContextCache +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrylistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrylistener/TestJobConfig.kt index b5a50dc6..7f985807 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrylistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrylistener/TestJobConfig.kt @@ -23,21 +23,24 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.retry.RetryCallback import org.springframework.retry.RetryContext import org.springframework.retry.RetryListener +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrypolicy/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrypolicy/TestJobConfig.kt index 03720a3f..13e1ac6d 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrypolicy/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/retrypolicy/TestJobConfig.kt @@ -23,19 +23,22 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.retry.policy.SimpleRetryPolicy +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/rollback/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/rollback/TestJobConfig.kt index 5151dedd..b1536e28 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/rollback/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/rollback/TestJobConfig.kt @@ -23,18 +23,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skip/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skip/TestJobConfig.kt index fdae95c2..8ded8c2f 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skip/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skip/TestJobConfig.kt @@ -23,18 +23,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skiplistener/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skiplistener/TestJobConfig.kt index 4d26c045..e7809578 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skiplistener/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skiplistener/TestJobConfig.kt @@ -24,18 +24,21 @@ import org.springframework.batch.core.SkipListener import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skiplistenerannotation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skiplistenerannotation/TestJobConfig.kt index 7eb3105a..4796bc39 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skiplistenerannotation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skiplistenerannotation/TestJobConfig.kt @@ -26,12 +26,15 @@ import org.springframework.batch.core.annotation.OnSkipInWrite import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { class TestListener { @@ -52,10 +55,10 @@ open class TestJobConfig { } @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skippolicy/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skippolicy/TestJobConfig.kt index 68976593..33d387de 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skippolicy/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/faulttolerant/skippolicy/TestJobConfig.kt @@ -24,18 +24,21 @@ import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy import org.springframework.batch.item.ItemProcessor import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/repeatoperation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/repeatoperation/TestJobConfig.kt index 815ba9b8..c787af12 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/repeatoperation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/chunkorientedstep/repeatoperation/TestJobConfig.kt @@ -25,21 +25,24 @@ import org.springframework.batch.item.ItemReader import org.springframework.batch.item.ItemWriter import org.springframework.batch.repeat.policy.SimpleCompletionPolicy import org.springframework.batch.repeat.support.RepeatTemplate -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob(batch: BatchDsl): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { val repeatOperations = RepeatTemplate().apply { setCompletionPolicy(SimpleCompletionPolicy(3)) } - chunk(repeatOperations, ResourcelessTransactionManager()) { + chunk(repeatOperations, transactionManager) { reader(testItemReader()) processor(testItemProcessor()) writer(testItemWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/allowstartifcomplete/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/allowstartifcomplete/TestJobConfig.kt index c0a4d7d8..a6f28932 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/allowstartifcomplete/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/allowstartifcomplete/TestJobConfig.kt @@ -21,17 +21,18 @@ package com.navercorp.spring.batch.plus.sample.step.configuration.allowstartifco import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("alwaysRunStep") { allowStartIfComplete(true) @@ -40,7 +41,7 @@ open class TestJobConfig { println("always run") RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } step("alwaysFailsStep") { @@ -48,7 +49,7 @@ open class TestJobConfig { { _, _ -> throw IllegalStateException("always failed") }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/listener/annotation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/listener/annotation/TestJobConfig.kt index e88ec921..85ac8f26 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/listener/annotation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/listener/annotation/TestJobConfig.kt @@ -23,12 +23,15 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.annotation.AfterStep import org.springframework.batch.core.annotation.BeforeStep import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { class TestListener { @BeforeStep @@ -43,13 +46,11 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { listener(TestListener()) - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/listener/object/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/listener/object/TestJobConfig.kt index b19ffc09..50720cbd 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/listener/object/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/listener/object/TestJobConfig.kt @@ -24,17 +24,18 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.StepExecution import org.springframework.batch.core.StepExecutionListener import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { listener( @@ -49,7 +50,7 @@ open class TestJobConfig { } }, ) - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/meterregistry/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/meterregistry/TestJobConfig.kt index 39f0f4b9..3b9c0f67 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/meterregistry/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/meterregistry/TestJobConfig.kt @@ -22,21 +22,22 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import io.micrometer.core.instrument.simple.SimpleMeterRegistry import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { meterRegistry(SimpleMeterRegistry()) - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/observationregistry/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/observationregistry/TestJobConfig.kt index 46a7819b..d8ba114a 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/observationregistry/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/observationregistry/TestJobConfig.kt @@ -22,21 +22,22 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import io.micrometer.observation.ObservationRegistry import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { observationRegistry(ObservationRegistry.create()) - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/TestJobConfig.kt index b4610c5f..a73c1763 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/repository/TestJobConfig.kt @@ -23,19 +23,19 @@ 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.batch.support.transaction.ResourcelessTransactionManager 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( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { repository( @@ -46,7 +46,7 @@ open class TestJobConfig( } }, ) - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/startlimit/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/startlimit/TestJobConfig.kt index ad74c98c..fd3e71d6 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/startlimit/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/configuration/startlimit/TestJobConfig.kt @@ -21,19 +21,20 @@ package com.navercorp.spring.batch.plus.sample.step.configuration.startlimit import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { private var count = 0 @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { startLimit(2) @@ -44,7 +45,7 @@ open class TestJobConfig { } RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/creation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/creation/TestJobConfig.kt index b7ef880b..ec57dba4 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/creation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/creation/TestJobConfig.kt @@ -21,34 +21,37 @@ package com.navercorp.spring.batch.plus.sample.step.creation import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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(): Job = batch { - job("testJob") { - // within job - step("testStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + open fun testJob(): Job { + return batch { + job("testJob") { + // within job + step("testStep1") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + } + step("testStep2") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + } + flow(testFlow()) + step(testStep()) } - step("testStep2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) - } - flow(testFlow()) - step(testStep()) } } @Bean open fun testStep() = batch { step("testStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } @@ -57,10 +60,10 @@ open class TestJobConfig( flow("testFlow") { // within flow step("flowStep1") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } step("flowStep2") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/bean/TestJobConfig.kt index 619598e9..d1c7145c 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/bean/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -43,8 +44,8 @@ open class TestJobConfig( @Bean open fun anotherFlow(): Flow = batch { flow("anotherFlow") { - step("anotherStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + step("anotherFlowStep") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/init/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/init/TestJobConfig.kt index 10ffc6c5..a401c30e 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/init/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/init/TestJobConfig.kt @@ -21,22 +21,23 @@ package com.navercorp.spring.batch.plus.sample.step.flowstep.init import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { flow("anotherFlow") { - step("anotherStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + step("anotherFlowStep") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/variable/TestJobConfig.kt index 2efe0ebd..3392d091 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/flowstep/variable/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.job.flow.Flow import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -43,8 +44,8 @@ open class TestJobConfig( @Bean open fun anotherFlow(): Flow = batch { flow("anotherFlow") { - step("anotherStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + step("anotherFlowStep") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/bean/TestJobConfig.kt index e9856f1a..d4a8806c 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/bean/TestJobConfig.kt @@ -21,13 +21,14 @@ package com.navercorp.spring.batch.plus.sample.step.jobstep.bean import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -43,7 +44,7 @@ open class TestJobConfig( open fun anotherJob() = batch { job("anotherJob") { step("anotherJobStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/config/extractor/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/config/extractor/TestJobConfig.kt index a5d64196..66c715a9 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/config/extractor/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/config/extractor/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.JobParametersBuilder import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -58,7 +59,7 @@ open class TestJobConfig( open fun anotherJob() = batch { job("anotherJob") { step("anotherJobStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/config/launcher/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/config/launcher/TestJobConfig.kt index c7037d5c..8c9cc291 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/config/launcher/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/config/launcher/TestJobConfig.kt @@ -22,13 +22,14 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.launch.JobLauncher import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 jobLauncher: JobLauncher, ) { @@ -59,7 +60,7 @@ open class TestJobConfig( open fun anotherJob() = batch { job("anotherJob") { step("anotherJobStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/variable/TestJobConfig.kt index 7ec3aaa9..550514ee 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/jobstep/variable/TestJobConfig.kt @@ -21,13 +21,14 @@ package com.navercorp.spring.batch.plus.sample.step.jobstep.variable import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager 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 @@ -43,7 +44,7 @@ open class TestJobConfig( open fun anotherJob() = batch { job("anotherJob") { step("anotherJobStep") { - tasklet({ _, _ -> RepeatStatus.FINISHED }, ResourcelessTransactionManager()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/aggregator/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/aggregator/TestJobConfig.kt index 0680f93b..01e6ea70 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/aggregator/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/aggregator/TestJobConfig.kt @@ -24,14 +24,15 @@ import org.springframework.batch.core.Step import org.springframework.batch.core.partition.support.DefaultStepExecutionAggregator import org.springframework.batch.item.ExecutionContext import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration open class TestJobConfig( private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, ) { @Bean @@ -63,7 +64,7 @@ open class TestJobConfig( println("[${Thread.currentThread().name}][${contribution.stepExecution.stepName}] run actual tasklet") RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/partitionhandler/direct/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/partitionhandler/direct/TestJobConfig.kt index 1d9aaba6..2f0c7596 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/partitionhandler/direct/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/partitionhandler/direct/TestJobConfig.kt @@ -24,14 +24,15 @@ import org.springframework.batch.core.Step import org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler import org.springframework.batch.item.ExecutionContext import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration open class TestJobConfig( private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, ) { @Bean @@ -64,7 +65,7 @@ open class TestJobConfig( println("[${Thread.currentThread().name}][${contribution.stepExecution.stepName}] run actual tasklet") RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/partitionhandler/inner/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/partitionhandler/inner/TestJobConfig.kt index fdd11f59..365d9af7 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/partitionhandler/inner/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/partitionhandler/inner/TestJobConfig.kt @@ -23,14 +23,15 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.item.ExecutionContext import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration open class TestJobConfig( private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, ) { @Bean @@ -62,7 +63,7 @@ open class TestJobConfig( println("[${Thread.currentThread().name}][${contribution.stepExecution.stepName}] run actual tasklet") RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/splitter/direct/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/splitter/direct/TestJobConfig.kt index c037aeb2..783a5139 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/splitter/direct/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/splitter/direct/TestJobConfig.kt @@ -25,14 +25,15 @@ import org.springframework.batch.core.StepExecution import org.springframework.batch.core.partition.StepExecutionSplitter import org.springframework.batch.core.repository.JobRepository import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration open class TestJobConfig( private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, private val jobRepository: JobRepository, ) { @@ -74,7 +75,7 @@ open class TestJobConfig( println("[${Thread.currentThread().name}][${contribution.stepExecution.stepName}] run actual tasklet") RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/splitter/inner/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/splitter/inner/TestJobConfig.kt index 914f3a3d..38ab6c47 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/splitter/inner/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/partitionstep/splitter/inner/TestJobConfig.kt @@ -23,14 +23,15 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.Step import org.springframework.batch.item.ExecutionContext import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration open class TestJobConfig( private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, ) { @Bean @@ -62,7 +63,7 @@ open class TestJobConfig( println("[${Thread.currentThread().name}][${contribution.stepExecution.stepName}] run actual tasklet") RepeatStatus.FINISHED }, - ResourcelessTransactionManager(), + transactionManager, ) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/bean/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/bean/TestJobConfig.kt index f214f9a0..3036ee11 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/bean/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/bean/TestJobConfig.kt @@ -23,21 +23,22 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.configuration.annotation.StepScope import org.springframework.batch.core.step.tasklet.Tasklet import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.beans.factory.annotation.Value import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - taskletBean("testTasklet", ResourcelessTransactionManager()) + taskletBean("testTasklet", transactionManager) } } } @@ -54,12 +55,10 @@ open class TestJobConfig { /* if not using bean name */ // @Bean - // open fun testJob( - // batch: BatchDsl - // ): Job = batch { + // open fun testJob(): Job = batch { // job("testJob") { // step("testStep") { - // tasklet(testTasklet(null), ResourcelessTransactionManager()) + // tasklet(testTasklet(null), transactionManager) // } // } // } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/exceptionhandler/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/exceptionhandler/TestJobConfig.kt index 837fd1b8..2ce6bc6f 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/exceptionhandler/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/exceptionhandler/TestJobConfig.kt @@ -21,20 +21,21 @@ package com.navercorp.spring.batch.plus.sample.step.taskletstep.config.exception import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.step.tasklet.Tasklet -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - tasklet(testTasklet(), ResourcelessTransactionManager()) { + tasklet(testTasklet(), transactionManager) { exceptionHandler { _, throwable -> println("handle exception ${throwable.message}") throw throwable diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/executor/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/executor/TestJobConfig.kt index d4f97de7..658be126 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/executor/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/executor/TestJobConfig.kt @@ -22,14 +22,17 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.step.tasklet.Tasklet import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.task.SimpleAsyncTaskExecutor import org.springframework.core.task.TaskExecutor +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun customExecutor(): TaskExecutor { @@ -42,12 +45,10 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - tasklet(testTasklet(), ResourcelessTransactionManager()) { + tasklet(testTasklet(), transactionManager) { taskExecutor(customExecutor()) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/listenerannotation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/listenerannotation/TestJobConfig.kt index a69b5dba..af885e58 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/listenerannotation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/listenerannotation/TestJobConfig.kt @@ -26,12 +26,15 @@ import org.springframework.batch.core.annotation.BeforeChunk import org.springframework.batch.core.scope.context.ChunkContext import org.springframework.batch.core.step.tasklet.Tasklet import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { class TestListener { @BeforeChunk @@ -50,12 +53,10 @@ open class TestJobConfig { } @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - tasklet(testTasklet(), ResourcelessTransactionManager()) { + tasklet(testTasklet(), transactionManager) { listener(TestListener()) } } diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/listenerobject/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/listenerobject/TestJobConfig.kt index 73b227ab..0d096998 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/listenerobject/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/listenerobject/TestJobConfig.kt @@ -24,20 +24,21 @@ import org.springframework.batch.core.Job import org.springframework.batch.core.scope.context.ChunkContext import org.springframework.batch.core.step.tasklet.Tasklet import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - tasklet(testTasklet(), ResourcelessTransactionManager()) { + tasklet(testTasklet(), transactionManager) { listener( object : ChunkListener { override fun beforeChunk(context: ChunkContext) { diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/stepoperation/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/stepoperation/TestJobConfig.kt index 1241bcea..d1eb40c9 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/stepoperation/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/stepoperation/TestJobConfig.kt @@ -25,20 +25,21 @@ import org.springframework.batch.repeat.RepeatCallback import org.springframework.batch.repeat.RepeatOperations import org.springframework.batch.repeat.RepeatStatus import org.springframework.batch.repeat.support.RepeatTemplate -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - tasklet(testTasklet(), ResourcelessTransactionManager()) { + tasklet(testTasklet(), transactionManager) { stepOperations( object : RepeatOperations { override fun iterate(callback: RepeatCallback): RepeatStatus { diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/stream/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/stream/TestJobConfig.kt index 1c4b1d30..2f68e7f6 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/stream/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/stream/TestJobConfig.kt @@ -24,20 +24,21 @@ import org.springframework.batch.core.step.tasklet.Tasklet import org.springframework.batch.item.ExecutionContext import org.springframework.batch.item.ItemStream import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - tasklet(testTasklet(), ResourcelessTransactionManager()) { + tasklet(testTasklet(), transactionManager) { stream( object : ItemStream { override fun open(executionContext: ExecutionContext) { diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/transactionattribute/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/transactionattribute/TestJobConfig.kt index 74c466a5..6587b574 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/transactionattribute/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/config/transactionattribute/TestJobConfig.kt @@ -22,22 +22,23 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.step.tasklet.Tasklet import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager import org.springframework.transaction.interceptor.DefaultTransactionAttribute import org.springframework.transaction.support.TransactionSynchronizationManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - tasklet(testTasklet(), ResourcelessTransactionManager()) { + tasklet(testTasklet(), transactionManager) { transactionAttribute( DefaultTransactionAttribute().apply { setName("test-tx") diff --git a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/variable/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/variable/TestJobConfig.kt index d7768835..75b80ff4 100644 --- a/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/variable/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-kotlin-dsl/src/main/kotlin/com/navercorp/spring/batch/plus/sample/step/taskletstep/variable/TestJobConfig.kt @@ -22,20 +22,21 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import org.springframework.batch.core.Job import org.springframework.batch.core.step.tasklet.Tasklet import org.springframework.batch.repeat.RepeatStatus -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - batch: BatchDsl, - ): Job = batch { + open fun testJob(): Job = batch { job("testJob") { step("testStep") { - tasklet(testTasklet(), ResourcelessTransactionManager()) + tasklet(testTasklet(), transactionManager) } } } diff --git a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/callback/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/callback/TestJobConfig.kt index 3a7c755c..79ae0184 100644 --- a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/callback/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/callback/TestJobConfig.kt @@ -23,21 +23,23 @@ import com.navercorp.spring.batch.plus.kotlin.item.adapter.asItemProcessor import com.navercorp.spring.batch.plus.kotlin.item.adapter.asItemStreamReader import com.navercorp.spring.batch.plus.kotlin.item.adapter.asItemStreamWriter import org.springframework.batch.core.Job -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun testJob( sampleTasklet: SampleTasklet, - batch: BatchDsl, ): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(sampleTasklet.asItemStreamReader()) processor(sampleTasklet.asItemProcessor()) writer(sampleTasklet.asItemStreamWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/readerprocessorwriter/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/readerprocessorwriter/TestJobConfig.kt index 1ff429b6..40b4986f 100644 --- a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/readerprocessorwriter/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/readerprocessorwriter/TestJobConfig.kt @@ -23,20 +23,22 @@ import com.navercorp.spring.batch.plus.kotlin.item.adapter.asItemProcessor import com.navercorp.spring.batch.plus.kotlin.item.adapter.asItemStreamReader import com.navercorp.spring.batch.plus.kotlin.item.adapter.asItemStreamWriter import org.springframework.batch.core.Job -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean open fun testJob( sampleTasklet: SampleTasklet, - batch: BatchDsl, ): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(sampleTasklet.asItemStreamReader()) processor(sampleTasklet.asItemProcessor()) writer(sampleTasklet.asItemStreamWriter()) diff --git a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/readerwriter/TestJobConfig.kt b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/readerwriter/TestJobConfig.kt index 524063e7..5d0b4c4c 100644 --- a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/readerwriter/TestJobConfig.kt +++ b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer-kotlin/src/main/kotlin/com/navercorp/spring/batch/plus/sample/readerwriter/TestJobConfig.kt @@ -22,21 +22,21 @@ import com.navercorp.spring.batch.plus.kotlin.configuration.BatchDsl import com.navercorp.spring.batch.plus.kotlin.item.adapter.asItemStreamReader import com.navercorp.spring.batch.plus.kotlin.item.adapter.asItemStreamWriter import org.springframework.batch.core.Job -import org.springframework.batch.support.transaction.ResourcelessTransactionManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.transaction.PlatformTransactionManager @Configuration -open class TestJobConfig { +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { @Bean - open fun testJob( - sampleTasklet: SampleTasklet, - batch: BatchDsl, - ): Job = batch { + open fun testJob(sampleTasklet: SampleTasklet): Job = batch { job("testJob") { step("testStep") { - chunk(3, ResourcelessTransactionManager()) { + chunk(3, transactionManager) { reader(sampleTasklet.asItemStreamReader()) writer(sampleTasklet.asItemStreamWriter()) } diff --git a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/callback/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/callback/TestJobConfig.java index a4b3791f..1de66af9 100644 --- a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/callback/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/callback/TestJobConfig.java @@ -26,9 +26,9 @@ import org.springframework.batch.core.job.builder.JobBuilder; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; @Configuration public class TestJobConfig { @@ -36,12 +36,13 @@ public class TestJobConfig { @Bean public Job testJob( SampleTasklet sampleTasklet, - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .start( new StepBuilder("testStep", jobRepository) - .chunk(3, new ResourcelessTransactionManager()) + .chunk(3, transactionManager) .reader(itemStreamReader(sampleTasklet)) .processor(itemProcessor(sampleTasklet)) .writer(itemStreamWriter(sampleTasklet)) diff --git a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/readerprocessorwriter/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/readerprocessorwriter/TestJobConfig.java index 43cce8b8..c13fd7cc 100644 --- a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/readerprocessorwriter/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/readerprocessorwriter/TestJobConfig.java @@ -26,9 +26,9 @@ import org.springframework.batch.core.job.builder.JobBuilder; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; @Configuration public class TestJobConfig { @@ -36,12 +36,13 @@ public class TestJobConfig { @Bean public Job testJob( SampleTasklet sampleTasklet, - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .start( new StepBuilder("testStep", jobRepository) - .chunk(3, new ResourcelessTransactionManager()) + .chunk(3, transactionManager) .reader(itemStreamReader(sampleTasklet)) .processor(itemProcessor(sampleTasklet)) .writer(itemStreamWriter(sampleTasklet)) diff --git a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/readerwriter/TestJobConfig.java b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/readerwriter/TestJobConfig.java index d9f6a805..e95472ce 100644 --- a/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/readerwriter/TestJobConfig.java +++ b/spring-batch-plus-sample/spring-batch-plus-single-class-reader-processor-writer/src/main/java/com/navecorp/spring/batch/plus/sample/readerwriter/TestJobConfig.java @@ -25,9 +25,9 @@ import org.springframework.batch.core.job.builder.JobBuilder; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.step.builder.StepBuilder; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.PlatformTransactionManager; @Configuration public class TestJobConfig { @@ -35,12 +35,13 @@ public class TestJobConfig { @Bean public Job testJob( SampleTasklet sampleTasklet, - JobRepository jobRepository + JobRepository jobRepository, + PlatformTransactionManager transactionManager ) { return new JobBuilder("testJob", jobRepository) .start( new StepBuilder("testStep", jobRepository) - .chunk(3, new ResourcelessTransactionManager()) + .chunk(3, transactionManager) .reader(itemStreamReader(sampleTasklet)) .writer(itemStreamWriter(sampleTasklet)) .build()