running scheduler in spring boot generates a process external to the spring boot application context

The @Scheduled should work. Have you added the @EnabledScheduling annotation to a @Configuration or the @SpringBootApplication? The Scheduling Getting Started explains it in detail.

Regarding the scheduleTask method: What calls that? Is it started outside the Spring context? If yes then Spring won’t stop it. You have to take care of the lifecycle.

You should try to use the @Scheduled as it will manage the thread pools/executors for you and most people will find it easier to understand.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top