要求是:在特定时间为不同国家/地区运行的春季批处理作业。
目前,"的cron"时间从属性file.can加载我动态地从sql数据库更改特定国家/地区的cron时间。
结论:需要根据国家/地区加载cron时间。
当前配置:
<bean id="taskscheduler" class="main.java.com.asbatch.newsfeed.BatchTaskScheduler"/>
<task:scheduled-tasks>
<task:scheduled ref="taskscheduler" method="run" cron="${newsfeed_time}"/>
</task:scheduled-tasks>
&#13;
BatchTaskScheduler类
public class BatchTaskScheduler
{
@Autowired
private JobLauncher launcher;
@Autowired
private Job job;
private static final Logger LOGGER = Logger.getLogger(BatchTaskScheduler.class);
public void run()
{
try
{
launcher.run(job, new JobParameters());
}
catch (JobExecutionAlreadyRunningException e)
{
LOGGER.info("JobExecutionAlreadyRunningException: " + e);
}
catch (JobRestartException e)
{
LOGGER.info("JobRestartException: " + e);
}
catch (JobInstanceAlreadyCompleteException e)
{
LOGGER.info("JobInstanceAlreadyCompleteException: " + e);
}
catch (JobParametersInvalidException e)
{
LOGGER.info("JobParametersInvalidException: " + e);
}
}
}
任何人都可以帮我这个吗?