Show Table of Contents
33.2. Enabling Spring Cache Support Declaratively (Remote Client-Server Mode)
Spring's cache support can be enabled declaratively by performing the following steps:
- Add
<cache:annotation-driven/>to the xml file. This line enables the standard spring annotations to be used by the application. - Define the HotRod client properties using the
<infinispan:remote-cache-manager ... />.
The following example demonstrates these changes:
Example 33.2. Sample Declarative Configuration
<?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:infinispan="http://www.infinispan.org/schemas/spring"
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/cache http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.infinispan.org/schemas/spring http://www.infinispan.org/schemas/infinispan-spring.xsd">
[...]
<cache:annotation-driven/>
<infinispan:remote-cache-manager
configuration="classpath:/path/to/hotrod-client.properties"/>
[...]
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.