如果你看看任务命名空间XSD,你会发现只有三个不同的配置类型:
fixed-delay,
fixed-rate和
cron。
并且,如果您查看ScheduledTasksBeanDefinitionParser的来源,您将看到最多只能评估这些值之一。这是相关的部分:
String cronAttribute = taskElement.getAttribute("cron");if (StringUtils.hasText(cronAttribute)) { cronTaskMap.put(runnableBeanRef, cronAttribute);}else { String fixedDelayAttribute = taskElement.getAttribute("fixed-delay"); if (StringUtils.hasText(fixedDelayAttribute)) { fixedDelayTaskMap.put(runnableBeanRef, fixedDelayAttribute); } else { String fixedRateAttribute = taskElement.getAttribute("fixed-rate"); if (!StringUtils.hasText(fixedRateAttribute)) { parserContext.getReaderContext().error( "One of 'cron', 'fixed-delay', or 'fixed-rate' is required", taskElement); // Continue with the possible next task element continue; } fixedRateTaskMap.put(runnableBeanRef, fixedRateAttribute); }}因此,没有办法组合这些属性。简而言之:名称空间无法帮助您。



