我想使用 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 工作需要哪些 spring 模块 jar?或者我至少在哪里可以找到这些信息?
谢谢
最佳答案
您还需要:
xmlns:cache="http://www.springframework.org/schema/cache"
正确的 xsd 是:
http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
关于java - 使用 Spring Cache 的依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5220476/