I am using spring boot and @schedule to scheduled some cron jobs to start at specific time ; however , I want to write code to be able to manipulate date and time in my spring boot application in order to test whether the cron job will be triggered or not , I know I can do this through change machine (OS) date , but I want to this through my application startup . I remember I've seen it somewhere , but I couldn't find it again .
@EnableScheduling
@SpringBootApplication
public class MainApplication {
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
}