If Hazelcast is on the classpath and a suitable configuration is found, Spring Boot
will auto-configure a HazelcastInstance
that you can inject in your application.
You can define a com.hazelcast.config.Config
bean and we’ll use that. If your
configuration defines an instance name, we’ll try to locate an existing instance rather
than creating a new one.
You could also specify the hazelcast.xml
configuration file to use via configuration:
spring.hazelcast.config=classpath:config/my-hazelcast.xml
Otherwise, Spring Boot tries to find the Hazelcast configuration from the default
locations, that is hazelcast.xml
in the working directory or at the root of the
classpath. We also check if the hazelcast.config
system property is set. Check the
Hazelcast documentation for
more details.
If hazelcast-client
is present on the classpath, Spring Boot will first attempt to
create a client with similar rules as above, that is:
com.hazelcast.client.config.ClientConfig
beanspring.hazelcast.config
propertyhazelcast.client.config
system propertyhazelcast-client.xml
in the working directory or at the root of the classpathNote | |
---|---|
Spring Boot also has an
explicit caching support for Hazelcast. The
|