Enabling caching

Before we can start using caching, we need to enable caching on the application. The following code snippet shows how we can enable caching:

    @EnableCaching    @SpringBootApplication    public class Application {

@EnableCaching would enable caching in a Spring Boot application.

Spring Boot automatically configures a suitable CacheManager ;framework to serve as a provider for the relevant cache. We will look at the details of how Spring Boot decides the CacheManager a little later.

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.