How to parameterize @Scheduled(fixedDelay) with Spring 3.0 expression language?

前端 未结 5 1407
谎友^
谎友^ 2020-11-28 21:21

When using the Spring 3.0 capability to annotate a scheduled task, I would like to set the fixedDelay as parameter from my configuration file, instead of hard-w

5条回答
  •  -上瘾入骨i
    2020-11-28 21:45

    I guess the @Scheduled annotation is out of question. So maybe a solution for you would be to use task-scheduled XML configuration. Let's consider this example (copied from Spring doc):

    
        
    
    

    ... or if the cast from String to Long didn't work, something like this would:

    
        
    
    

    Again, I haven't tried any of these setups, but I hope it might help you a bit.

提交回复
热议问题