From 8bf5b814e1d06f493ba690cb381742629ca90955 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Wed, 13 Mar 2024 00:16:40 +0900 Subject: [PATCH] Delegate getExecutionContextSerializer() to DefaultBatchConfiguration if not provided See gh-38328 --- .../boot/autoconfigure/batch/BatchAutoConfiguration.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java index 7a2e4e2a5eb3..8635c1f9c5ea 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java @@ -26,7 +26,6 @@ import org.springframework.batch.core.launch.JobLauncher; import org.springframework.batch.core.repository.ExecutionContextSerializer; import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.core.repository.dao.DefaultExecutionContextSerializer; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.autoconfigure.AutoConfiguration; @@ -118,8 +117,7 @@ static class SpringBootBatchConfiguration extends DefaultBatchConfiguration { this.transactionManager = batchTransactionManager.getIfAvailable(() -> transactionManager); this.properties = properties; this.batchConversionServiceCustomizers = batchConversionServiceCustomizers.orderedStream().toList(); - this.executionContextSerializer = executionContextSerializer - .getIfAvailable(DefaultExecutionContextSerializer::new); + this.executionContextSerializer = executionContextSerializer.getIfAvailable(); } @Override @@ -155,7 +153,8 @@ protected ConfigurableConversionService getConversionService() { @Override protected ExecutionContextSerializer getExecutionContextSerializer() { - return this.executionContextSerializer; + return (this.executionContextSerializer != null) ? this.executionContextSerializer + : super.getExecutionContextSerializer(); } }