title: How to enable ehCache (3.x) in SpringMVC (5.x) project
body: <p>In our project we use the <code>ehcache</code> 2.x and now we want to migrate to 3.x but somehow I fail tremendously. In 2.x we have the configuration in <code>ehcache.xml</code>. To what I read is that I need to change the content as well when using 3.x. </p>
  
  <p>But first of all I have no clue how to wire the Cache by itself. I have</p>
  
  <pre><code>@EnableCaching
  @Configuration
  public class CacheConf {
    @Bean
    public CacheManager cacheManager() {
      final CacheManagerBuilder&lt;org.ehcache.CacheManager&gt; ret = CacheManagerBuilder.newCacheManagerBuilder();
      ret.withCache("properties", getPropCache());
      ret.withCache("propertyTypes", getPropCache());
      return (CacheManager) ret.build(true);
    }
  ....
  </code></pre>
  
  <p>But this configuration I get a <code>java.lang.ClassCastException: org.ehcache.core.EhcacheManager cannot be cast to org.springframework.cache.CacheManager</code> which means that I cannot set the <code>ehcache</code> properly.</p>
  
  <p>Note: In 2.x we configured different types of caches, more or less due to the expiration period - and since other object types are stored therein.</p>
  
  <p>Hints to get it running, cause I didn't find a working sample with Spring 5 and <code>ehcache</code> 3.x? Best would be a config without xml!</p>