title: What is the best way to disable ehcache in JHipster
body: <p>I want EHCache in production, but not in development as I tend to fiddle with database records in development.</p>
  
  <p>The only thing I came across after searching is this JVM option to disable cache completely <code>-Dnet.sf.ehcache.disabled=true</code>, but somehow this does not appear to be the ideal solution.</p>
  
  <p>Best would be to have an option in <strong>application-dev.yml</strong>. I tinkered with <strong>timeToLiveSeconds</strong> and kept it low (1), but it did not seem to have any effect. </p>
  
  <p>I tried to add an api in my REST service like this, but it did not seem to have any effect either:</p>
  
  <pre><code>/**
   * GET  /clearCache -&gt; Clear Cache
   */
  @RequestMapping(value = "/clearCache",
          method = RequestMethod.GET,
          produces = MediaType.APPLICATION_JSON_VALUE)
  @Timed
  public ResponseEntity&lt;String&gt; clearCache() {
      CacheManager.getInstance().clearAll();
      return new ResponseEntity&lt;String&gt;(HttpStatus.OK);
  }
  </code></pre>
  
  <p>Also, a corollary to this same question, I put a debug breakpoint in <strong>CacheConfiguration.java</strong> here, but it never seems to get hit. </p>
  
  <pre><code>@PreDestroy
  public void destroy() {
  </code></pre>
  
  <p>Any help is highly appreciated!</p>
  
  <p>Here is my full log on startup with fast boot:</p>
  
  <pre><code>[INFO] mypackage.Application - Starting Application on Lenovo-PC with PID 7408 (D:\projects\app\target\classes started by lenovo in D:\projects\app)
  [DEBUG] mypackage.Application - Running with Spring Boot v1.2.4.RELEASE, Spring v4.1.6.RELEASE
  [DEBUG] org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
  [DEBUG] mypackage.config.DatabaseConfiguration - Configuring Datasource
  [WARN] org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [mypackage.Org]; using defaults.
  [WARN] org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [mypackage.Workflow]; using defaults.
  [WARN] org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [mypackage.Department]; using defaults.
  ...
  ...
  ...
  
  [DEBUG] mypackage.config.MailConfiguration - Configuring mail server
  [INFO] mypackage.Application - Running with Spring profile(s) : [dev, fast]
  </code></pre>