I am using spring framework v4.1.7 and have problems scheduling a cron task where I want to define the cron parameter in the properties file.
My Java code is:
@Scheduled(cron = "${invoice.export.cron}") private void scheduledExport() {
and in my properties file I have invoice.export.cron: 0 0 7 * * MON-FRI? To enable scheduling, I have @EnableScheduling in my main configuration class.
I tried to debug this problem and found that the cron expression should be resolved from the placeholder property here . after calls to resolveStringValue me to this place in AbstractBeanFactory . And as far as I can see, here is the problem. the list this.embeddedValueResolvers empty ... therefore it does not resolve the property i passed to @Scheduled(cron) .
Does anyone have an idea if I am doing something wrong or have missed something?
Thanks in advance!:)
source share