2017-04-14 45 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