Ehcache 3.x настроить ошибку типа ключ/значение

Я интегрировал SpringFramwork с Ehcache 3.x и получил исключение при указании типов ключ/значение в ehcache.xml. Это моя конфигурация:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ehcache.org/v3" xmlns:jsr107="http://www.ehcache.org/v3/jsr107"
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.0.xsd">

<persistence directory="${user.home}/.ehcache" />
<cache alias="mycache">
    <key-type>java.lang.String</key-type>
    <value-type>java.lang.String</value-type>
    <resources>
        <offheap unit="GB">1</offheap>
        <heap unit="MB">300</heap>
        <disk unit="GB" persistent="true">10</disk>
    </resources>
</cache>

and I get exception:Cache [XXX] specifies key/value types. Use getCache(String, Class, Class). Here is the stacktrack:

Caused by: java.lang.IllegalArgumentException: Cache [homeFeeds] specifies key/value types. Use getCache(String, Class, Class)
at org.ehcache.jsr107.Eh107CacheManager.getCache(Eh107CacheManager.java:297)
at org.springframework.cache.jcache.JCacheCacheManager.loadCaches(JCacheCacheManager.java:105)
at org.springframework.cache.support.AbstractCacheManager.initializeCaches(AbstractCacheManager.java:61)
at org.springframework.cache.support.AbstractCacheManager.afterPropertiesSet(AbstractCacheManager.java:50)
at org.springframework.cache.jcache.JCacheCacheManager.afterPropertiesSet(JCacheCacheManager.java:97)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 35 more

Что-то не так с моей конфигурацией?


person BuggyShow    schedule 17.08.2017    source источник


Ответы (1)


Я рекомендую вам прочитать мой ответ на это другой вопрос, который был очень похож на ваш, если не такой же

person Anthony Dahanne    schedule 18.08.2017