title: load data from DB at startup using caffeine cache and i need to use cached data whenever i want in spring boot?
body: <p>Configuration class to config caffeine</p>
  
  <pre><code>@Configuration
  public class CacheConfig
  {
      @Bean(name = "cacheManager")
      @Primary
      public CacheManager caffeineCacheManager() {
          SimpleCacheManager cacheManager = new SimpleCacheManager();
          CaffeineCache definitionCache = new CaffeineCache("Cache_Data",
                  Caffeine.newBuilder().maximumSize(400).build());
          cacheManager.setCaches(Arrays.asList(definitionCache));
          return cacheManager;
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>/*Service class to get the data*/   
  @Service
  @CacheConfig(cacheManager="cacheManager")
  public class LocalCacheServiceImpl {
      @Cacheable("Cache_Data")
      public String getdata(String value)
      {   
          return value;
      }
  }
  </code></pre>