Skip to content

Commit f1f9b2d

Browse files
committed
Final changes
1 parent 7a87aa8 commit f1f9b2d

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

docs/modules/ROOT/pages/hazelcast-embedded-springboot.adoc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,40 +47,45 @@ include::ROOT:example$hazelcast-embedded-springboot/src/main/java/guides/hazelca
4747

4848
Run the application using Maven in a terminal:
4949

50+
[source,bash]
5051
----
51-
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dserver.port=8080"
52+
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dserver.port=8080 -Djava.net.preferIPv4Stack=true"
5253
----
5354

5455
Then, rerun the application in another terminal.
5556

5657
NOTE: Notice the different value for the `server.port` argument.
5758

59+
[source,bash]
5860
----
59-
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dserver.port=8081"
61+
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dserver.port=8081 -Djava.net.preferIPv4Stack=true"
6062
----
6163

6264
After both application instances are initialized, you should see that the Hazelcast cluster is formed:
6365

64-
```bash
66+
[source,bash]
67+
----
6568
Members {size:2, ver:2} [
6669
Member [192.168.1.64]:5701 - 520aec3f-58a6-4fcb-a3c7-498dcf37d8ff
6770
Member [192.168.1.64]:5702 - 5c03e467-d457-4847-b49a-745a335db557 this
6871
]
69-
```
72+
----
7073

7174
Now, you can issue HTTP requests to put and get data back. Run the following command to put the data into a Hazelcast distributed map:
7275

73-
```bash
76+
[source,bash]
77+
----
7478
curl --data "key=key1&value=hazelcast" "localhost:8080/put"
75-
```
79+
----
7680

7781
You will see the value in the output. Then run the command below to get the data back. Please note that the call is made to the other application instance:
7882

79-
```bash
83+
[source,bash]
84+
----
8085
curl "localhost:8081/get?key=key1"
81-
```
86+
----
8287

83-
Again, you will see the value in the output since the data is distributed among Hazelcast cluster instances and can be accessed from any of them.
88+
Again, you will see the value in the output (`{"value":"hazelcast"}`), because the data is distributed among Hazelcast cluster instances and can be accessed from any of them.
8489

8590
== Test the Application
8691

0 commit comments

Comments
 (0)