Backend Development
Spring Boot
Subjective
Oct 03, 2025
How do you implement scheduled tasks in Spring Boot?
Detailed Explanation
Use @Scheduled annotation:\n\n@EnableScheduling\n@SpringBootApplication\npublic class Application { }\n\n@Component\npublic class ScheduledTasks {\n @Scheduled(fixedRate = 5000)\n public void reportCurrentTime() {\n log.info("Current time: {}", new Date());\n }\n \n @Scheduled(cron = "0 0 12 * * ?")\n public void dailyReport() {\n // Daily report logic\n }\n}
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts