Can I insert an instance of TaskScheduler created by Spring?
I would like to schedule tasks programmatically and for this, I think I need to access TaskScheduler , but for some reason it was not found using Spring for auto-preparation.
@Configuration @EnableScheduling public class MySpringConfig { } @Component public class MyClass implements InitializingBean { @Autowired private TaskScheduler taskScheduler; @Override public void afterPropertiesSet() throws Exception { ... } }
Any idea?
Thanks!
source share