@SpringBootApplication
@EnableScheduling
@EnableAsync
public class SpringBootSchedularApp {
public static void main(String[] args) {
SpringApplication.run(SpringBootSchedularApp.class, args);
}
int count=0;
@Scheduled(fixedRate = 1000)
@Async
public void cronJobSchedular() {
System.out.println("Enter: "+count);
for(int i=0;i<10;i++) {
System.out.println(i);
try {
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
}
count++;
}
}