hazelcast.adoc (spring-boot-2.7.3) | : | hazelcast.adoc (spring-boot-2.7.4) | ||
---|---|---|---|---|
[[io.hazelcast]] | [[io.hazelcast]] | |||
== Hazelcast | == Hazelcast | |||
If https://hazelcast.com/[Hazelcast] is on the classpath and a suitable configur ation is found, Spring Boot auto-configures a `HazelcastInstance` that you can i nject in your application. | If https://hazelcast.com/[Hazelcast] is on the classpath and a suitable configur ation is found, Spring Boot auto-configures a `HazelcastInstance` that you can i nject in your application. | |||
Spring Boot first attempts to create a client by checking the following configur ation options: | Spring Boot first attempts to create a client by checking the following configur ation options: | |||
* The presence of a `com.hazelcast.client.config.ClientConfig` bean. | * The presence of a `com.hazelcast.client.config.ClientConfig` bean. | |||
* A configuration file defined by the configprop:spring.hazelcast.config[] prope rty. | * A configuration file defined by the configprop:spring.hazelcast.config[] prope rty. | |||
* The presence of the `hazelcast.client.config` system property. | * The presence of the `hazelcast.client.config` system property. | |||
* A `hazelcast-client.xml` in the working directory or at the root of the classp ath. | * A `hazelcast-client.xml` in the working directory or at the root of the classp ath. | |||
* A `hazelcast-client.yaml` in the working directory or at the root of the class path. | * A `hazelcast-client.yaml` (or `hazelcast-client.yml`) in the working directory or at the root of the classpath. | |||
WARNING: Hazelcast 3 support is deprecated. | WARNING: Hazelcast 3 support is deprecated. | |||
If you still need to downgrade to Hazelcast 3, `hazelcast-client` should be adde d to the classpath to configure a client. | If you still need to downgrade to Hazelcast 3, `hazelcast-client` should be adde d to the classpath to configure a client. | |||
If a client can not be created, Spring Boot attempts to configure an embedded se rver. | If a client can not be created, Spring Boot attempts to configure an embedded se rver. | |||
If you define a `com.hazelcast.config.Config` bean, Spring Boot uses that. | 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 e xisting instance rather than creating a new one. | If your configuration defines an instance name, Spring Boot tries to locate an e xisting instance rather than creating a new one. | |||
You could also specify the Hazelcast configuration file to use through configura tion, as shown in the following example: | You could also specify the Hazelcast configuration file to use through configura tion, as shown in the following example: | |||
[source,yaml,indent=0,subs="verbatim",configprops,configblocks] | [source,yaml,indent=0,subs="verbatim",configprops,configblocks] | |||
---- | ---- | |||
spring: | spring: | |||
hazelcast: | hazelcast: | |||
config: "classpath:config/my-hazelcast.xml" | config: "classpath:config/my-hazelcast.xml" | |||
---- | ---- | |||
Otherwise, Spring Boot tries to find the Hazelcast configuration from the defaul t locations: `hazelcast.xml` in the working directory or at the root of the clas spath, or a `.yaml` counterpart in the same locations. | Otherwise, Spring Boot tries to find the Hazelcast configuration from the defaul t locations: `hazelcast.xml` in the working directory or at the root of the clas spath, or a `.yaml`/`.yml` counterpart in the same locations. | |||
We also check if the `hazelcast.config` system property is set. | We also check if the `hazelcast.config` system property is set. | |||
See the https://docs.hazelcast.org/docs/latest/manual/html-single/[Hazelcast doc umentation] for more details. | See the https://docs.hazelcast.org/docs/latest/manual/html-single/[Hazelcast doc umentation] for more details. | |||
TIP: By default, `@SpringAware` on Hazelcast components is supported. | TIP: By default, `@SpringAware` on Hazelcast components is supported. | |||
The `ManagementContext` can be overridden by declaring a `HazelcastConfigCustomi zer` bean with an `@Order` higher than zero. | The `ManagementContext` can be overridden by declaring a `HazelcastConfigCustomi zer` bean with an `@Order` higher than zero. | |||
NOTE: Spring Boot also has <<io#io.caching.provider.hazelcast,explicit caching s upport for Hazelcast>>. | NOTE: Spring Boot also has <<io#io.caching.provider.hazelcast,explicit caching s upport for Hazelcast>>. | |||
If caching is enabled, the `HazelcastInstance` is automatically wrapped in a `Ca cheManager` implementation. | If caching is enabled, the `HazelcastInstance` is automatically wrapped in a `Ca cheManager` implementation. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |