Currently, we use the @Scheduled
annotation from quarkus-scheduler
to periodically execute a method:
@Scheduled(every = "10s")
void sync() {
...
}
I would like to make the interval configurable in application.properties
. Is there a way to inject a configuration property into the value of the every
parameter? E.g. something like @Scheduled(every = "${sync.interval}")
.
The every attribute supports Property Expressions including default values and nested Property Expressions.
(Note that "{property.path}" style expressions are still supported but don’t offer the full functionality of Property Expressions.)
Interval Config Property Example
https://quarkus.io/guides/config-reference#property-expressions
https://quarkus.io/guides/scheduler-reference#intervals