匹配的通配符是严格的,但是没有找到元素'ehcache:annotation-driven'的声明

时间:2016-06-15 05:28:20

标签: spring spring-mvc caching

I used spring cache in my application . XML file where i configure ehcache is as below : 

<?xml version="1.0" encoding="UTF-8"?>
<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:webflow="http://www.springframework.org/schema/webflow-config"
    xmlns:mvc="http://www.springframework.org/schema/mvc" 
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
    xmlns:cache="http://www.springframework.org/schema/cache"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
        http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-3.1.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/cache 
        http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
        http://www.springframework.org/schema/task 
        http://www.springframework.org/schema/task/spring-task-3.1.xsd ">

This is code for declaring bean for ehcache . But this code create problem 
and so me error message "cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'ehcache:annotation-driven'."


<ehcache:annotation-driven cache-manager="ehCacheManager" />
    <bean id="ehCacheManager"
        class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
        <property name="configLocation">
            <value>/WEB-INF/config/ehcache.xml</value>
        </property>
    </bean>

我使用了谷歌缓存网址,但它让我在2天前收到错误消息。在搜索互联网上我发现谷歌关闭了这项服务。他建议我添加spring缓存并在代码中添加这些行

添加 的xmlns:缓存= “http://www.springframework.org/schema/cache”

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

添加代码后,它会显示错误:

cvc-complex-type.2.4.c:匹配的通配符是strict,但是找不到元素'ehcache:annotation-driven'的声明。

任何人都可以帮助我如何解决这个问题。

0 个答案:

没有答案