java / beginner
Snippet
Scheduling Tasks
The @Scheduled annotation allows you to run methods automatically at fixed intervals or using cron expressions. This requires @EnableScheduling to be active in your app.
snippet.java
java
1
2
3
4
@Scheduled(fixedRate = 60000)public void runEveryMinute() {System.out.println("Minute check-in performed");}
spring
Breakdown
1
@Scheduled(fixedRate = 60000)
Triggers the method every 60,000 milliseconds (1 minute).