2017-04-14 43 views
1

我想在Spring中使用EhCache。我跟着tutorial它說這行添加到我的spring.xml:EhCache Spring XML集成命名空間

<ehcache:annotation-driven cache-manager="ehCacheManager" /> 

的問題是,在命名空間的Ehcache中不存在的教程。尋找在谷歌,我發現了以下Spring配置:

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 
xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring" 
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd 
http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring 
http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd"> 

但我得到的XSD架構中的錯誤沒有發現,實際上,如果我按照XSD URL,我收到了404

所以問題是,我在哪裏可以找到名稱空間和模式?

爲了清楚起見,這裏的錯誤,我得到了註解驅動線:

謝謝。

回答

1

我用:

<beans ... 
    xmlns:cache="http://www.springframework.org/schema/cache" 
    xsi:schemaLocation=" 
     ... 
     http://www.springframework.org/schema/cache 
     http://www.springframework.org/schema/cache/spring-cache.xsd 

<cache:annotation-driven cache-manager="cacheManager" /> 

然後特​​異性結合的Ehcache是​​在CacheManager中豆

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" ... /> 
+0

就是這樣,謝謝!不知道爲什麼它很難找到......我猜這個項目在春天裏一直都在鋪開...... – Aurasphere