How can I use @Scheduled annotation of spring dynamically?
CronTrigger(String expression, TimeZone timeZone)
As I have multiple timeZones in database, how can I pass them dynamically?
I tried this in my code:
TimeZone timezone = null;
String timezone1 = null;
public SchedulerBean(String timezone2)
{
this.timezone1 = timezone2;
//constructor
}
@Scheduled(cron="0 0 8 * * ?", zone =timezone.getTimeZone(timezone1) ) //Error at this line
public void sendQuestionNotif()
{
//......code
}
Here is the error I am getting,
*Type mismatch: cannot convert from TimeZone to String*
Please help me. Because I want to trigger cron based on timezones. TIA.