@Scheduled methods in @Lazy beans are not scheduled [SPR-17587] #22119
Labels
Comments
Juergen Hoeller commented This works as designed: If you want a singleton bean's scheduled methods to be called from startup onwards, simply don't declare it as lazy. If you want some backend state to only be created once actually called, factor it out to a separate bean that your |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Silvio Assunção Junior opened SPR-17587 and commented
The issue #17470 was not resolved, the problem continue
I checked the code of ScheduledAnnotationBeanPostProcessor and the tasks will registered on method postProcessAfterInitialization, but lazy Beans it is not created or initialized, than Beans with
@Scheduled
and@Lazy
does not work correctlyThe Schedule will be registered only if I will use the Bean (Force a creation)
Other guys with the same problem https://stackoverflow.com/questions/47585846/why-spring-schedule-do-not-work-with-lazy
Affects: 4.3.18
Reference URL: #17470
Issue Links:
@Scheduled
methods in@Lazy
beans are not scheduledThe text was updated successfully, but these errors were encountered: