Spring, Spring Boot, Spring Framework, Java, Programming.
thread public void task1() { // Task logic goes here System.out.println("Task 1 executed."); } @Scheduled(cron = "*/5 * * * * *") // Execute every 5 seconds @Async // Execute in a separate thread public void task2() { // Task logic goes here System.out.println("Task 2 executed."); try {