如何动态使用spring的@Scheduled注解?
CronTrigger(String expression, TimeZone timeZone)
由于我在数据库中有多个时区,如何动态传递它们?
我在我的代码中试过这个:
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
}
这是我得到的错误,
*Type mismatch: cannot convert from TimeZone to String*
请帮我。因为我想根据timezones触发cron。TIA。