Hi Shreshth,
Apparently the instructions for client/server topology in the guide are not complete and I will create an issue to improve them. That being said, let me explain the steps here for now:
1) Create a cluster with the configuration file under resources and cache-api on the classpath. Using
Hazelcast CLI, it looks like:
$ hz start -c src/main/resources/hazelcast.yaml -j ~/.m2/repository/javax/cache/cache-api/1.1.1/cache-api-1.1.1.jar
2) Update application.properties
spring.cache.jcache.provider=com.hazelcast.client.cache.HazelcastClientCachingProvider
3) Since hazelcast.yaml exists under resources, Spring's auto configuration will kick in after detected this file and create embedded Hazelcast by default. To prevent this, you can remove this file, or replace it with your Hazelcast client config, or disable auto configuration via:
// Application.java
@SpringBootApplication(exclude = HazelcastAutoConfiguration.class)
4) Run the application and test it.
mvn clean spring-boot:run
curl localhost:8080/books/12345 <--------- response with 3 sec delay
curl localhost:8080/books/12345 <--------- response from cache without delay
Note that when you restart the Spring app, you will get the response without delay - as it will be existing in the cache.
Regards,
Enes O.