Aurasphere
Aurasphere

Reputation: 4011

EhCache Spring XML integration namespace

I'd like to use EhCache with Spring. I've followed a tutorial which said to add this line to my spring.xml:

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

The problem is that the ehcache namespace is not present in the tutorial. Looking on Google I've found out the following spring configuration:

<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:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
xsi:schemaLocation="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://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring
http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd">

But I get an error about the xsd schema not found and actually if I follow the xsd URL I get a 404.

So the question is, where do I find the namespace and schema?

For the sake of clarity, here's the errors I get on the annotation-driven line:

Thank you.

Upvotes: 1

Views: 2566

Answers (1)

Alohci
Alohci

Reputation: 83006

I use:

<beans ...
    xmlns:cache="http://www.springframework.org/schema/cache"
    xsi:schemaLocation="
        ...
        http://www.springframework.org/schema/cache 
        http://www.springframework.org/schema/cache/spring-cache.xsd

and

<cache:annotation-driven cache-manager="cacheManager" />

Then the specific binding to ehcache is in the cacheManager bean

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" ... />

Upvotes: 3

Related Questions