I\'m using Spring Boot
and have issues scheduling a cron task
using values existing in database.
For the time being, I\'m reading values f
you can add a bean to get cron value from database in the SpringBootApplication main class or in any of the configuration class. Example code is below:
@Autowired
private CronRepository cronRepo;
@Bean
public int getCronValue()
{
return cronRepo.findOne("cron").getCronValue();
}
you should create a table and provide suitable values in the database. After that you can provide the bean inside the @Scheduled
. Example code is below:
@Scheduled(cron="#{@getCronValue}")
Hope it works for your issue.