diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/mongodb/MongoStepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/mongodb/MongoStepExecutionDao.java index a7bac8ce26..0c2531bfdc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/mongodb/MongoStepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/mongodb/MongoStepExecutionDao.java @@ -36,6 +36,7 @@ /** * @author Mahmoud Ben Hassine + * @author Yanming Zhou * @since 5.2.0 */ public class MongoStepExecutionDao implements StepExecutionDao { @@ -114,7 +115,7 @@ public StepExecution getLastStepExecution(JobInstance jobInstance, String stepNa Optional lastStepExecution = stepExecutions .stream() .filter(stepExecution -> stepExecution.getName().equals(stepName)) - .min(Comparator + .max(Comparator .comparing(org.springframework.batch.core.repository.persistence.StepExecution::getCreateTime) .thenComparing(org.springframework.batch.core.repository.persistence.StepExecution::getId)); if (lastStepExecution.isPresent()) {