SPR-6670 @Scheduled now supports property placeholders for cron expressions.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,6 +27,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
@@ -113,6 +114,10 @@ public class ScheduledAnnotationBeanPostProcessor implements BeanPostProcessor,
|
||||
String cron = annotation.cron();
|
||||
if (!"".equals(cron)) {
|
||||
processedSchedule = true;
|
||||
if (applicationContext instanceof ConfigurableApplicationContext) {
|
||||
cron = ((ConfigurableApplicationContext) applicationContext)
|
||||
.getBeanFactory().resolveEmbeddedValue(cron);
|
||||
}
|
||||
cronTasks.put(runnable, cron);
|
||||
}
|
||||
long fixedDelay = annotation.fixedDelay();
|
||||
|
||||
Reference in New Issue
Block a user