声明<ehcache:annotation驱动的cache-manager =“ ehCacheManager”> bean时出错

时间:2018-12-28 17:35:57

标签: pom.xml ehcache

在工作中,我们使用Spring(或更确切地说是Google)的ehcache管理器。奇怪的是,我在Spring STS中遇到了一个错误,我的同事(也使用Spring STS并使用完全相同的代码)没有收到错误。我的pom.xml文件中的以下行被标记为错误(或根据Spring STS标记为“问题”)。

<ehcache:annotation-driven cache-manager="ehCacheManager" />

给出的原因是这样的:

The matching wildcard is strict, but no declaration can be found for element 'ehcache:annotation-driven'.

如果可能会有所帮助,这是我pom.xml文件顶部的模式声明。

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
xmlns:tx="http://www.springframework.org/schema/tx" 
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
    http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.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">

Spring STS和我的特定项目/工作区都使用Java 8作为编译器和运行时环境。所以我认为这不是问题。我还进行了项目刷新,Maven更新和mvn全新安装。

我做了一些研究,研究了this questionthis one。结论似乎是我的模式之一不再托管,因此无法弄清楚<ehcache:annotation-driven cache-manager="ehCacheManager"/>的含义。似乎缺少http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd模式,如果您只是尝试访问URL,则可以确认。

this question的评论建议我避免使用Google ehcache,而应使用Spring ehcache。我应该怎么做?理想情况下,我希望避免更改我们使用的架构,因为毕竟它适用于我的同事。但这也许是因为他们能够从仍托管的Google ehcache模式中提取信息。是否真的有必要从Google模式更改为Spring模式?如果是,该如何在我的POM文件中实现呢?

0 个答案:

没有答案