[英]How do you configure the spring integration poller after XSD changes have invalidated the fixed-delay and fixed-rate attributes?
[英]How to make fixed-rate dynamic in XML based task schedulers?
<task:scheduled-tasks>
<task:scheduled ref="testBean" method="testMethod" fixed-rate="1000"/>
</task:scheduled-tasks>
在上面的代码片段中,我想将固定利率作为从配置文件中获取的变量传递。 我怎样才能做到这一点?
PS 我不想移动到基于注释的调度程序。
在浏览了各种文章和文档之后,我找到了实现相同目标的方法。 所以分享一样。
我创建了一个加载器 class 的配置 bean。加载器 class 负责获取配置(从文件或任何配置管理工具)并在系统属性中设置。
<bean id="configuration" class="com.test.config.loader">
</bean>
说一个属性就像数据库:mysql
它可以像
<task:scheduled-tasks>
<task:scheduled ref="testBean" method="testMethod" fixed-rate="#{configuration['database']}"/>
</task:scheduled-tasks>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.