Hazelcast Spring Data integration Project http://projects.spring.io/spring-data/


Spring Data Hazelcast

Welcome to Spring Data Hazelcast project!

Build Status

The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use data access technologies.

Spring Data Hazelcast project will enable the Spring Data paradigm to gain the power of a distributed data repository.

I have the power!

Join the community

Chat with developers



so icon Submit your question with hazelcast and spring-data-hazelcast tags.

Mail Group

Please, join the mail group if you are interested in using or developing Hazelcast.


The Spring platform is a commonly used environment and Hazelcast is the most widely used IMDG. Therefore it is natural to provide a way to use Hazelcast via Spring in a standard, platform neutral manner and to provide a baseline implementation of Spring Data Hazelcast that can be enhanced with Hazelcast specific features.

The implementation is built on the new Spring Data KeyValue module and is one of the first projects to do this. This module provides infrastructure components for creating repository abstractions for stores dealing with Key/Value pairs like java.util.Map or Hazelcast IMap.

Through the means of the repository interface, CRUD operations, and expression-based query methods can interrogate an in-memory data store in a manner consistent with the other Spring Data projects allowing developers to be productive quickly and easily.


  • Familiar "Spring Data" approach, developers do not need to learn a new technology to be able to use it

  • Utilizes the new Spring-Data-Key value abstraction, we did not reinvent the wheel

  • FURTHER​ eases the integration of Hazelcast into Spring and clouds

  • Reduces vendor lock-in. One can swap Hazelcast in place of more expensive or slower options


Spring Configuration
@EnableHazelcastRepositories(basePackages={"example.springdata.keyvalue.chemistry"}) (1)
public class ApplicationConfiguration {

    HazelcastInstance hazelcastInstance() {     (2)
        return Hazelcast.newHazelcastInstance();
        // return HazelcastClient.newHazelcastClient();

    public KeyValueOperations keyValueTemplate() {  (3)
        return new KeyValueTemplate(new HazelcastKeyValueAdapter(hazelcastInstance()));

    public HazelcastKeyValueAdapter hazelcastKeyValueAdapter(HazelcastInstance hazelcastInstance) {
        return new HazelcastKeyValueAdapter(hazelcastInstance);
  1. Enables Spring Data magic for Hazelcast. You can specify basePackages for component scan.

  2. Instantiates Hazelcast instance (a member or a client)

  3. Instantiates KV template

A repository class definition
public interface SpeakerRepository extends HazelcastRepository<Speaker, Long> {}
A test of repository
@ContextConfiguration(classes = AppConfiguration.class)
public class AppTest {
    SpeakerRepository speakerRepository;

    public void testStart(){



Add this to your pom.xml


// Add dependency
dependencies {
    compile 'com.hazelcast:spring-data-hazelcast:1.0'


Hazelcast is available under the Apache 2 License. Please see the Licensing appendix for more information.

Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.

Visit http://www.hazelcast.com for more information.