This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.3.4!spring-doc.cn

This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.3.4!spring-doc.cn

If Hazelcast is on the classpath and a suitable configuration is found, Spring Boot auto-configures a HazelcastInstance that you can inject in your application.spring-doc.cn

Spring Boot first attempts to create a client by checking the following configuration options:spring-doc.cn

  • The presence of a com.hazelcast.client.config.ClientConfig bean.spring-doc.cn

  • A configuration file defined by the spring.hazelcast.config property.spring-doc.cn

  • The presence of the hazelcast.client.config system property.spring-doc.cn

  • A hazelcast-client.xml in the working directory or at the root of the classpath.spring-doc.cn

  • A hazelcast-client.yaml (or hazelcast-client.yml) in the working directory or at the root of the classpath.spring-doc.cn

If a client can not be created, Spring Boot attempts to configure an embedded server. If you define a com.hazelcast.config.Config bean, Spring Boot uses that. If your configuration defines an instance name, Spring Boot tries to locate an existing instance rather than creating a new one.spring-doc.cn

You could also specify the Hazelcast configuration file to use through configuration, as shown in the following example:spring-doc.cn

spring.hazelcast.config=classpath:config/my-hazelcast.xml
spring:
  hazelcast:
    config: "classpath:config/my-hazelcast.xml"

Otherwise, Spring Boot tries to find the Hazelcast configuration from the default locations: hazelcast.xml in the working directory or at the root of the classpath, or a YAML counterpart in the same locations. We also check if the hazelcast.config system property is set. See the Hazelcast documentation for more details.spring-doc.cn

By default, @SpringAware on Hazelcast components is supported. The ManagementContext can be overridden by declaring a HazelcastConfigCustomizer bean with an @Order higher than zero.
By default, @SpringAware on Hazelcast components is supported. The ManagementContext can be overridden by declaring a HazelcastConfigCustomizer bean with an @Order higher than zero.
Spring Boot also has explicit caching support for Hazelcast. If caching is enabled, the HazelcastInstance is automatically wrapped in a CacheManager implementation.
Spring Boot also has explicit caching support for Hazelcast. If caching is enabled, the HazelcastInstance is automatically wrapped in a CacheManager implementation.