Ihar Hancharenka 22ec535058 m
2025-01-08 14:07:30 +03:00

26 строки
902 B
Plaintext

https://spring.io/guides/gs/scheduling-tasks/
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/scheduling/annotation/Scheduled.html
at main app
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/scheduling/annotation/EnableScheduling.html
later...
@Scheduled(initialDelay = ONE_SECOND, fixedDelay = ONE_MINUTE)
https://en.wikipedia.org/wiki/ISO_8601#Durations
@Scheduled(fixedDelay = ${interval})
2021
https://reflectoring.io/spring-scheduler/
https://github.com/thombergs/code-examples/tree/master/spring-boot/spring-boot-scheduler
samples
@ConditionalOnProperty(value = "app.scheduling.enabled", havingValue = "true", matchIfMissing = true)
@Configuration
@EnableScheduling
public class SchedulingConfig {
...
}