Add support for Hazelcast

This commit upgrades to Hazelcast 4.0.3, yet keeping compatibility with
Hazelcast 3.x.

Closes gh-20856
Closes gh-23475
This commit is contained in:
Stephane Nicoll
2020-09-09 17:48:49 +02:00
parent 7b183ef99d
commit 4009acf025
32 changed files with 418 additions and 79 deletions

View File

@@ -6207,6 +6207,18 @@ The {spring-boot-module-code}/jta/atomikos/AtomikosXAConnectionFactoryWrapper.ja
== Hazelcast
If https://hazelcast.com/[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 Boot first attempts to create a client by checking the following configuration options:
* The presence of a `com.hazelcast.client.config.ClientConfig` bean.
* A configuration file defined by the configprop:spring.hazelcast.config[] property.
* The presence of the `hazelcast.client.config` system property.
* A `hazelcast-client.xml` in the working directory or at the root of the classpath.
* A `hazelcast-client.yaml` in the working directory or at the root of the classpath.
NOTE: Spring Boot supports both Hazelcast 4 and Hazelcast 3.
If you downgrade to Hazelcast 3, `hazelcast-client` should be added to the classpath to configure a client.
If a client can't 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.
@@ -6221,14 +6233,6 @@ Otherwise, Spring Boot tries to find the Hazelcast configuration from the defaul
We also check if the `hazelcast.config` system property is set.
See the https://docs.hazelcast.org/docs/latest/manual/html-single/[Hazelcast documentation] for more details.
If `hazelcast-client` is present on the classpath, Spring Boot first attempts to create a client by checking the following configuration options:
* The presence of a `com.hazelcast.client.config.ClientConfig` bean.
* A configuration file defined by the configprop:spring.hazelcast.config[] property.
* The presence of the `hazelcast.client.config` system property.
* A `hazelcast-client.xml` in the working directory or at the root of the classpath.
* A `hazelcast-client.yaml` in the working directory or at the root of the classpath.
NOTE: Spring Boot also has <<boot-features-caching-provider-hazelcast,explicit caching support for Hazelcast>>.
If caching is enabled, the `HazelcastInstance` is automatically wrapped in a `CacheManager` implementation.