By default Spring Boot will use just a single thread for all scheduled tasks to run on. This is not ideal, because these tasks will be blocking. Instead we will configure the scheduler to run each scheduled tasks on a separate thread (if there is enough threads available).

In the above example, the databaseCleanup() method will be called once every minute, with an initial delay (after the application has started) of 1 minute. Instead of a fixed rate, you could instead use a cron expression.