I am creating a timer application that uses Quartz, also am using spring to initialise my DB from schema.sql file. When application starts I want to DB be initialised before my Scheduler bean is created.
@Bean
public Scheduler scheduler() throws SchedulerException {
Scheduler scheduler;
final StdSchedulerFactory stdSchedulerFactory = new StdSchedulerFactory("application.properties");
stdSchedulerFactory.initialize();
scheduler = stdSchedulerFactory.getScheduler();
scheduler.start();
return scheduler;
}
Scheduler bean is inside TimerConfiguration.java which is added to TimerApplication like
@SpringBootApplication
@Import({TimerConfiguration.class})
public class TimerApplication {
Is there a way to achieve this ?