Hi all,
I have a Spring 4/Hibernate 5 app where I use hazelcast as my second level Hibernate cache with TCP joining using the HazelcastLocalCacheRegionFactory. It all works well when hazelcast loads configuration from a hazelcast.xml config file on the application classpath.
What I am trying to achieve now is external configuration of members of the TCP cluster. I am aware that I can set a system property for the app to look for an external hazelcast.xml file. However, we have a dedicated configuration file for our app and I would like to integrate the hazelcast cluster member config there, to make it simpler to set up and avoid having a second config file.
I have experimented with the following options:
- The hazelcast spring configuration namespace. The problem seems to be that Spring/Hibernate does not pick it up when starting the HazelcastLocalCacheRegionFactory. In Spring Hibernate 4 there is a property which allows for injecting a "cacheRegionFactory" on the LocalSessionFactoryBean but this does not seem to be there for the Spring Hibernate 5 integration.
- Using Java programmatic configuration where I retrieve the HazelcastInstance and modify it. The problem seems to be that a configuration cannot be modified once it's created.
So to summarize, I am looking to specify the hazelcast config during startup of my app (reading from my config file). Could take place in a spring managed bean or in spring namespace.
Are there anyone who know how to programatically configure hazelcast for hibernate second level cache using Spring 4.2 and Hibernate 5 ?
Details:
Spring version: 4.2.5.RELEASE
spring-orm: 4.2.5.RELEASE
Hibernate version: 5.1.0.Final
hazelcast version: 3.6.4
hazelcast-spring version: 3.6.4
hazelcast-hibernate5 version: 1.0
Replies would be greatly appreciated.
best regards,
Lars