栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用Spring任务名称空间将任务调度为一次运行

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用Spring任务名称空间将任务调度为一次运行

如果你看看任务命名空间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);    }}

因此,没有办法组合这些属性。简而言之:名称空间无法帮助您。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/414094.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号