Skip to content

Commit 775ceb1

Browse files
Merge pull request #4 from hazelcast-guides/DOCS-778_spring_boot_client
Viridian -> Cloud
2 parents ab0b865 + 698a742 commit 775ceb1

File tree

6 files changed

+38
-36
lines changed

6 files changed

+38
-36
lines changed

README.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
= Spring Boot Application for Hazelcast Viridian
1+
= Spring Boot Application for Hazelcast Cloud
22
:experimental: true
33

4-
This is an example of how to use Spring Boot with Hazelcast Viridian.
4+
This is an example of how to use Spring Boot with Hazelcast {hazelcast-cloud}.
55

66
TIP: For step-by-step instructions of how to run this app, see the link:https://docs.hazelcast.com/tutorials/spring-boot-client[tutorial].
77

88
== Quickstart
99

1010
. Add the required properties to `spring-sample/src/main/resources/application.properties`:
1111

12-
- `clusterName`
12+
- `clusterId`
1313
- `discoveryToken`
1414
- `keyStorePassword`
1515
- `trustStorePassword` (same as `keyStorePassword`)
@@ -24,7 +24,7 @@ TIP: For step-by-step instructions of how to run this app, see the link:https://
2424

2525
== Internal Hazelcast Developers
2626

27-
If you want to try this application in the UAT or DEV environment, edit the `src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java` file to include the environment URL:
27+
If you want to try this application in the UAT or DEV environment, edit the `src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java` file to include the environment URL:
2828

2929
```java
3030
// For DEV, use https://test.dev.hazelcast.cloud

docs/modules/ROOT/pages/spring-boot-client.adoc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You need the following:
2626
- A xref:cloud:ROOT:create-serverless-cluster.adoc[{hazelcast-cloud} Standard cluster].
2727
- link:https://git-scm.com/book/en/v2/Getting-Started-Installing-Git[Git]
2828
- link:https://maven.apache.org/install.html[Maven]
29-
- JDK 8
29+
- JDK 17 or later
3030
- `JAVA_HOME` environment variable set to the path of the JDK
3131

3232

@@ -61,9 +61,11 @@ cd spring-boot-sample
6161

6262
. Open the `src/main/resources/application.properties` file.
6363

64-
. Add connection credentials for your cluster to the `application.properties` file. You can find these credentials in the {hazelcast-cloud} dashboard for your cluster under *Connect Client* > *Advanced Setup*.
64+
. Add connection credentials for your cluster to the `application.properties` file.
6565
+
66-
- `clusterName`
66+
NOTE: You can find these credentials in the {hazelcast-cloud} dashboard for your cluster; clusterID is provided in the *Cluster details*, and the other credentials in the *Advanced* option under *Connect Client*.
67+
+
68+
- `clusterID`
6769
- `discoveryToken`
6870
- `keyStorePassword`
6971
- `trustStorePassword` (same as `keyStorePassword`)
@@ -83,17 +85,17 @@ include::spring-boot-sample:example$pom.xml[tag=client]
8385
link:{github-directory}/pom.xml[View source]
8486
====
8587

86-
.`HzViridianDemoApplication.java`
88+
.`HzCloudDemoApplication.java`
8789
[%collapsible]
8890
====
8991
Spring Boot first attempts to create a Hazelcast client by checking the presence of a `com.hazelcast.client.config.ClientConfig` bean. This bean is configured using the information in the `application.properties` file.
9092
9193
[source,java]
9294
----
93-
include::spring-boot-sample:example$src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java[tag=class]
95+
include::spring-boot-sample:example$src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java[tag=class]
9496
----
9597
96-
link:{github-directory}/src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java[View source]
98+
link:{github-directory}/src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java[View source]
9799
====
98100

99101
.`MapService.java`
@@ -103,10 +105,10 @@ When the `com.hazelcast.client.config.ClientConfig` bean is present, a `Hazelcas
103105
104106
[source,java]
105107
----
106-
include::spring-boot-sample:example$src/main/java/sample/com/hazelcast/demo/viridian/MapService.java[tag=class]
108+
include::spring-boot-sample:example$src/main/java/sample/com/hazelcast/demo/cloud/MapService.java[tag=class]
107109
----
108110
109-
link:{github-directory}/src/main/java/sample/com/hazelcast/demo/viridian/MapService.java[View source]
111+
link:{github-directory}/src/main/java/sample/com/hazelcast/demo/cloud/MapService.java[View source]
110112
====
111113

112114
== Step 2. Connect the Client
@@ -131,7 +133,7 @@ mvnw.cmd spring-boot:run
131133
--
132134
====
133135

134-
The client connects to the cluster and adds 10 random entries to a map called `MyMap`.
136+
The client connects to the cluster and adds ten random entries to a map called `MyMap`.
135137

136138
```
137139
...

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.hz.demos</groupId>
12-
<artifactId>hz-viridian-demo</artifactId>
12+
<artifactId>hz-cloud-demo</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<name>hz-viridian-demo</name>
15-
<description>hz-viridian-demo</description>
14+
<name>hz-cloud-demo</name>
15+
<description>hz-cloud-demo</description>
1616
<properties>
1717
<java.version>11</java.version>
1818
</properties>

src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java renamed to src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sample.com.hazelcast.demo.viridian;
1+
package sample.com.hazelcast.demo.cloud;
22

33
import java.io.IOException;
44
import java.util.Properties;
@@ -15,24 +15,24 @@
1515

1616
// tag::class[]
1717
@SpringBootApplication
18-
public class HzViridianDemoApplication {
18+
public class HzCloudDemoApplication {
1919

2020
public static void main(String[] args) {
21-
SpringApplication.run(HzViridianDemoApplication.class, args);
21+
SpringApplication.run(HzCloudDemoApplication.class, args);
2222
}
2323

2424
@ConditionalOnProperty(
25-
name = "hazelcast.viridian.tlsEnabled",
25+
name = "hazelcast.cloud.tlsEnabled",
2626
havingValue = "true"
2727
)
2828
@Bean
2929
ClientConfig hazelcastClientConfig(
30-
@Value("${hazelcast.viridian.discoveryToken}") String discoveryToken,
31-
@Value("${hazelcast.viridian.clusterName}") String clusterName,
32-
@Value("${hazelcast.viridian.keyStore}") Resource keyStore,
33-
@Value("${hazelcast.viridian.keyStorePassword}") String keyStorePassword,
34-
@Value("${hazelcast.viridian.trustStore}") Resource trustStore,
35-
@Value("${hazelcast.viridian.trustStorePassword}") String trustStorePassword
30+
@Value("${hazelcast.cloud.discoveryToken}") String discoveryToken,
31+
@Value("${hazelcast.cloud.clusterId}") String clusterId,
32+
@Value("${hazelcast.cloud.keyStore}") Resource keyStore,
33+
@Value("${hazelcast.cloud.keyStorePassword}") String keyStorePassword,
34+
@Value("${hazelcast.cloud.trustStore}") Resource trustStore,
35+
@Value("${hazelcast.cloud.trustStorePassword}") String trustStorePassword
3636
) throws IOException {
3737
Properties props = new Properties();
3838
props.setProperty("javax.net.ssl.keyStore", keyStore.getURI().getPath());
@@ -46,8 +46,8 @@ ClientConfig hazelcastClientConfig(
4646
.getCloudConfig()
4747
.setDiscoveryToken(discoveryToken)
4848
.setEnabled(true);
49-
config.setClusterName(clusterName);
50-
config.setProperty("hazelcast.client.cloud.url", "https://api.viridian.hazelcast.com");
49+
config.setClusterId(clusterId);
50+
config.setProperty("hazelcast.client.cloud.url", "https://api.cloud.hazelcast.com");
5151

5252
return config;
5353
}

src/main/java/sample/com/hazelcast/demo/viridian/MapService.java renamed to src/main/java/sample/com/hazelcast/demo/cloud/MapService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sample.com.hazelcast.demo.viridian;
1+
package sample.com.hazelcast.demo.cloud;
22

33
import java.util.Map;
44
import java.util.UUID;
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
hazelcast.viridian.clusterName=
2-
hazelcast.viridian.discoveryToken=
3-
hazelcast.viridian.tlsEnabled=true
4-
hazelcast.viridian.keyStore=classpath:/client.keystore
5-
hazelcast.viridian.keyStorePassword=
6-
hazelcast.viridian.trustStore=classpath:/client.truststore
7-
hazelcast.viridian.trustStorePassword=
1+
hazelcast.cloud.clusterId=
2+
hazelcast.cloud.discoveryToken=
3+
hazelcast.cloud.tlsEnabled=true
4+
hazelcast.cloud.keyStore=classpath:/client.keystore
5+
hazelcast.cloud.keyStorePassword=
6+
hazelcast.cloud.trustStore=classpath:/client.truststore
7+
hazelcast.cloud.trustStorePassword=

0 commit comments

Comments
 (0)