[JAVA-26046] Upgraded spring-scheduling to spring boot 3 (#14939)

This commit is contained in:
panos-kakos 2023-10-16 13:22:06 +03:00 committed by GitHub
parent 6d7040879b
commit f2e1547920
3 changed files with 9 additions and 11 deletions

View File

@ -10,9 +10,9 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId> <artifactId>parent-boot-3</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2</relativePath> <relativePath>../parent-boot-3</relativePath>
</parent> </parent>
<dependencies> <dependencies>
@ -33,21 +33,19 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${annotation-api.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId> <artifactId>spring-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies> </dependencies>
<properties> <properties>
<spring-retry.version>2.0.0</spring-retry.version> <spring-retry.version>2.0.3</spring-retry.version>
<annotation-api.version>1.3.2</annotation-api.version>
</properties> </properties>
</project> </project>

View File

@ -37,7 +37,7 @@ public class DynamicSchedulingConfig implements SchedulingConfigurer {
Instant nextExecutionTime = Instant nextExecutionTime =
lastCompletionTime.orElseGet(Date::new).toInstant() lastCompletionTime.orElseGet(Date::new).toInstant()
.plusMillis(tickService.getDelay()); .plusMillis(tickService.getDelay());
return Date.from(nextExecutionTime); return Date.from(nextExecutionTime).toInstant();
} }
); );
} }

View File

@ -2,7 +2,7 @@ package com.baeldung.taskscheduler;
import java.util.Date; import java.util.Date;
import javax.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;