-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Daniel Moses opened SPR-16424 and commented
ScheduledTaskRegistrar.getScheduledTasks() only gives a set of all tasks that were registered before bean creation (it gets populated afterPropertiesSet). The following methods don't keep the scheduled task set up to date: addCronTask, scheduleCronTask, etc.
This easily tested by creating a simple spring boot with actuator application and the following configuration/properties. (spring-boot 2.0.0.M7)
@Configuration
@EnableScheduling
public class TaskConfig implements SchedulingConfigurer {
public void runTask() {}
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.scheduleCronTask(new CronTask(this::runTask, "0 0/1 * * * ?"));
}
}
properties:
management.endpoint.scheduledtasks.enabled=true
management.endpoints.web.expose=info,status,scheduledtasks
Also of concern is that the list of tasks are not filtered if they were canceled.
Affects: 5.0.2
Issue Links:
- Provide read access to the scheduled tasks at runtime [SPR-15982] #20532 Provide read access to the scheduled tasks at runtime