In our Spring web-application, we are moving from XML based configuration to Annotation based configuration.
I'm stuck with a scheduled task defined with this XML
<task:scheduled-tasks scheduler="cacheScheduler">
<task:scheduled ref="currencyExchangeRateTask" method="cacheCurrencyExchangeRates" cron="0 0 8,20 * * *" />
</task:scheduled-tasks>
There are multiple schedulers in our web-application. And this task needs to be executed on the scheduler with id cacheScheduler
.
I have now the following annotation in place
@Scheduled(cron = "0 0 8,20 * * *")
public void cacheCurrencyExchangeRates() {
...
}
This is executing on the default scheduler.
How can this be fixed without XML configuration?