From c2a4bf61461d4e00118820fddd3355c27e6e33e7 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Tue, 22 Oct 2024 11:22:39 +0200 Subject: [PATCH] Fix last step execution retrieval in MongoStepExecutionDao Resolves https://github.com/spring-projects-experimental/spring-batch-experimental/issues/3 --- .../batch/core/repository/dao/MongoStepExecutionDao.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MongoStepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MongoStepExecutionDao.java index 44215babd..9b889c1d8 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MongoStepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MongoStepExecutionDao.java @@ -111,6 +111,7 @@ public class MongoStepExecutionDao implements StepExecutionDao { // first one Optional lastStepExecution = stepExecutions .stream() + .filter(stepExecution -> stepExecution.getName().equals(stepName)) .min(Comparator .comparing(org.springframework.batch.core.repository.persistence.StepExecution::getCreateTime) .thenComparing(org.springframework.batch.core.repository.persistence.StepExecution::getId));