Skip to content

@Scheduled methods in @Lazy beans are not scheduled [SPR-12872] #17470

Closed
@spring-projects-issues

Description

@spring-projects-issues

Ivan Bovin opened SPR-12872 and commented

If we have a @Scheduled method in a @Lazy bean, it will be added to ScheduledTaskRegistrar (e.g. using a addFixedDelayTask method) but not scheduled in the taskScheduler.

Example:

@Lazy
@Component
public class SampleBean {
    @Scheduled(fixedDelay = 500)
    public void task() {
        System.out.println("-");
    }
}

Affects: 4.1.5

Issue Links:

Referenced from: commits ab478d1

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions