2017-02-02 9 views
0

私はehCacheの設定に助けが必要です。 私がやったこれら:Spring EhCacheの設定 - クラスが見つかりません[org.springframework.cache.ehcache.EhCacheManagerFactoryBean]

ehcache.xmlを私のsrc/main/resourcesフォルダ内

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="ehcache.xsd" 
updateCheck="true" 
monitoring="autodetect" 
dynamicConfig="true"> 

<diskStore path="java.io.tmpdir" /> 

<cache name="allNodesCache" 
    maxEntriesLocalHeap="10000" 
    maxEntriesLocalDisk="1000" 
    eternal="false" 
    diskSpoolBufferSizeMB="20" 
    timeToIdleSeconds="300" timeToLiveSeconds="600" 
    memoryStoreEvictionPolicy="LFU" 
    transactionalMode="off"> 
    <persistence strategy="localTempSwap" /> 
</cache> 

私のApplicationContext-web.xmlの内部Ehcacheの構成

<!-- ehCache configuration --> 
<cache:annotation-driven /> 
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cache-manager-ref="ehcache"/> 
<!-- EhCache library setup --> 
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:config-location="ehcache.xml"/> 

pom.xml:

<!-- ehCache --> 
    <dependency> 
     <groupId>net.sf.ehcache</groupId> 
     <artifactId>ehcache</artifactId> 
     <version>2.7.2</version> 
    </dependency> 

マイリポジトリクラス: クラスを見つけることができません[org.springframework:

@Repository 

JpaRepository {

@Cacheable(value = "allNodesCache", key = "#node") 
@Query("select new com.datum.fnd.domain.Node(c.idNode, c.name, c.address, c.description, c.point) from Node c") 

を拡張NodeRepositoryパブリックインターフェイス私はこのようなメッセージが表示されました.cache.ehcache.EhCacheManagerFactoryBean] for ServletContextリソース[/WEB-INF/spring/applicationContext-web.xml]で定義されている名前 'ehcache'のBean。ネストされた例外は、java.lang.ClassNotFoundExceptionがある:org.springframework.cache.ehcache.EhCacheManagerFactoryBean

+0

を使用するライブラリの異なるバージョンを追加してください。 –

+0

私は自分のehcache.xmlをwebappフォルダに移動することで私の問題を解決しました –

答えて

関連する問題