September 2015
Intermediate to advanced
206 pages
4h 45m
English
Earlier in this chapter, we discussed how the command-line runners can be used as a place to start the scheduled executor thread pools in order to run the worker threads in intervals. While that is certainly a possibility, Spring provides you with a more concise configuration to achieve the same goal: @EnableScheduling.
We will enhance our application so that it will print a count of books in our repository every 10 seconds. To achieve this, we will make the necessary modifications to the BookPubApplication and StartupRunner classes.
@EnableScheduling annotation to the BookPubApplication class, as follows:@SpringBootApplication
@EnableScheduling
public class BookPubApplication {…}Read now
Unlock full access