java - 使用 Spring Cache 的依赖

标签 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 工作需要哪些 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/

相关文章:

Java - Jackson 注释来处理没有合适的构造函数

caching - Varnish 4,清理 - 我以为我已经弄清楚了一切

multithreading - 共享缓存如何在SQLite中工作?

java - 仅用于自动驱逐事件的 RemovalListener

java - 如何编写 ETL 以根据 Oracle UNDO 设置进行操作?

java - 哪个开源 Python 或 Java 库提供了一种在 ESRI Shapefile 上绘制圆圈的简单方法?

java - 如何检查一个函数是否已经在java中被调用?

java - 用唯一的数字表示一组字符串,也可以根据数字进行排序。

java - Spring 定义的映射将 bean 名称作为键而不是指定的键值

java - Spring 4方法拦截器并使用自定义实现