Open Gitter Chat
FREE, online, self-paced, learning for Hazelcast at the Hazelcast Training Center. Learn More »

Caching: Spring Cache

Hazelcast IMDG® can be used as cache for applications based on the Spring Framework –distributing shared data in real-time.

The Spring Framework provides an abstraction layer for caching providers, which is a first class citizen in Hazelcast IMDG. Within the default Hazelcast® download /lib directory there is a JAR file hazelcast-spring-.jar which is included in the hazelcast-all..jar By including hazelcast-all.jar or hazelcast-spring.jar, hazelcast can be used as an implementation of the Spring Cache Abstraction layer and can annotate methods as @Cacheable.

As of version 3.1, Spring Framework provides support for adding caching into an existing Spring application. To use Hazelcast as Spring cache provider, you should just define a com.hazelcast.spring.cache.HazelcastCacheManager bean and register it as Spring cache manager.

<cache:annotation-driven cache-manager="cacheManager" />
<hz:hazelcast id="hazelcast">
<bean id="cacheManager" class="com.hazelcast.spring.cache.HazelcastCacheManager">
<constructor-arg ref="instance"/>

Hazelcast supports other integration points with the Spring Framework, which can be seen in our documentation here:

Get Hands-on Training

Sign up for hands-on training from Hazelcast experts, online or in the classroom.

Learn more at Hazelcast University

Hazelcast IMDG Deployment and Operations Guide

Download it Now