Skip to content

ScheduledTaskRegistrar to provide all scheduled tasks with getScheduledTasks() [SPR-16424] #20970

@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions