Skip to content

Commit

Permalink
Delegate getExecutionContextSerializer() to DefaultBatchConfiguration…
Browse files Browse the repository at this point in the history
… if not provided

See spring-projectsgh-39911
  • Loading branch information
izeye authored and scottfrederick committed Mar 12, 2024
1 parent 261ed4f commit d9d305b
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -155,7 +153,8 @@ protected ConfigurableConversionService getConversionService() {

@Override
protected ExecutionContextSerializer getExecutionContextSerializer() {
return this.executionContextSerializer;
return (this.executionContextSerializer != null) ? this.executionContextSerializer
: super.getExecutionContextSerializer();
}

}
Expand Down

0 comments on commit d9d305b

Please sign in to comment.