使用Spring Cache的依赖关系

时间:2011-03-07 13:51:25

标签: java spring caching dependencies spring-3

我想使用Spring Cache features,但我不知道这个模块有什么依赖。我的配置如下:

<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需要哪些弹簧模块罐?或者我可以在哪里找到这些信息?

由于

2 个答案:

答案 0 :(得分:6)

您还需要:

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

正确的xsd是:

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

答案 1 :(得分:0)

您是否了解此功能是Spring 3.1的一部分,尚未发布是?

因此,您需要使用milestone build of Spring 3.1.

中的Spring jar