2011-03-07 61 views
1

我想使用Spring Cache features,但我不知道此模块具有哪些依赖关系。我有这样的配置:使用Spring Cache的依赖关系

<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:mvc="http://www.springframework.org/schema/mvc" 
xmlns:p="http://www.springframework.org/schema/p" 
xmlns:cache="http://www.springframework.org/schema/cache" 
xsi:schemaLocation=" 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
    http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> 

    ... 

<mvc:annotation-driven /> 
<cache:annotation-driven /> 

<cache:annotation-driven />没有被认可。它给出了这样的错误:

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cache:annotation-driven' 

我想谈到,因为我没有一个Spring模块的JAR文件,因为我没有加入所有的(我加入他们,当我真正需要它们)。

需要什么弹簧模块的罐子来获得Spring Cache的工作?或弹性体我在哪里可以找到这些信息?

感谢

回答

6

您还需要:

xmlns:cache="http://www.springframework.org/schema/cache" 

和正确的XSD是:

http://www.springframework.org/schema/cache/spring-cache-3.1.xsd 
+0

我已经又增加了它春瓶,虽然我还没有包括在我的问题。必须有更多的东西丢失(我认为它可能是一个jar文件) – Javi 2011-03-07 14:11:35

+0

@Javi看到更新 – Bozho 2011-03-07 14:13:08

+0

谢谢,错误停止。 http://static.springsource.org/spring/docs/3.1.0.M1/spring-framework-reference/html/cache.html中的文档说我有xsd,所以我认为它是错误的。还有一个问题。我应该将mvc xsd从spring-mvc-3.0.xsd更改为spring-mvc-3.1.xsd(因为文档中还提到了spring-mvc-3.0.xsd)? – Javi 2011-03-07 15:25:51

0

你明白这个功能是春天3.1,这是没有公布的一部分是?

所以,你需要使用从milestone build of Spring 3.1.

+0

我已经在使用那个里程碑版本的jar了 – Javi 2011-03-07 15:16:03

+0

@Javi:运行一个程序或IDE时是否遇到这个错误? – axtavt 2011-03-07 15:25:34

+0

在IDE中,我认为Bozho答案是正确的,虽然由于另一个错误我没有检查它 – Javi 2011-03-07 15:27:40