Search code examples
xmlspringcronspring-integration

Spring Integration @Scheduled alternative for cron expression with 7 fields and zone parameter


@Scheduled doesn't take 7 fields anymore. What are the alternatives if I need the year field for the cron expression? I looked and saw Quartz cron trigger takes in 7 fields, but not sure if it'll work with spring integration inbound adapters?


Solution

  • You are right: there is no year field support in the org.springframework.scheduling.support.CronTrigger. And there is no Quartz support in Spring Integation's poller. However you still can configure a Quartz to call your method for inbound channel adapter and produce a message to the channel.

    See more info here:

    https://docs.spring.io/spring-framework/reference/integration/scheduling.html#scheduling-quartz

    https://github.com/spring-projects/spring-integration/issues/6705