Skip to content

Commit dc8a5e5

Browse files
committed
Upgrade to to Spring Boot 3.4.x and Java 21
1 parent 0048993 commit dc8a5e5

File tree

13 files changed

+50
-28
lines changed

13 files changed

+50
-28
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ jobs:
3030
# We must fetch at least the immediate parents so that if this is
3131
# a pull request then we can checkout the head.
3232
fetch-depth: 2
33-
- name: Set up JDK 17
34-
uses: actions/setup-java@v1
33+
- name: Set up JDK 21
34+
uses: actions/setup-java@v4
3535
with:
36-
java-version: 17
36+
distribution: temurin
37+
java-version: 21
3738
# If this run was triggered by a pull request event, then checkout
3839
# the head of the pull request instead of the merge commit.
3940
- run: git checkout HEAD^2

.github/workflows/docker-graalvm-native-image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Set Image Tag Version
3131
uses: actions/setup-java@v4
3232
with:
33-
java-version: 17
33+
java-version: 21
3434
distribution: temurin
3535
- run: echo "TAG_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
3636

@@ -39,6 +39,6 @@ jobs:
3939
with:
4040
context: .
4141
file: src/main/docker/Dockerfile.native
42-
platforms: linux/amd64,linux/arm64
42+
platforms: linux/amd64,linux/arm64,linux/arm/v7
4343
push: true
4444
tags: rawsanj/spring-redis-websocket:${{ env.TAG_VERSION }}-native

.github/workflows/docker-jvm-image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Set Image Tag Version
3131
uses: actions/setup-java@v4
3232
with:
33-
java-version: 17
33+
java-version: 21
3434
distribution: temurin
3535
- run: echo "TAG_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
3636

@@ -39,6 +39,6 @@ jobs:
3939
with:
4040
context: .
4141
file: src/main/docker/Dockerfile.jvm
42-
platforms: linux/amd64,linux/arm64
42+
platforms: linux/amd64,linux/arm64,linux/arm/v7
4343
push: true
4444
tags: rawsanj/spring-redis-websocket:${{ env.TAG_VERSION }}-jvm

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2023 Sanjay Rawat
189+
Copyright 2025 Sanjay Rawat
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## Multi-instance Reactive Chat App using Spring Boot WebFlux and Redis Pub/Sub
1111

12-
Scalable Java 17 Spring Boot 3.x WebFlux Chat Application to demonstrate use of Reactive Redis [Pub/Sub] using
12+
Scalable Java 21 Spring Boot 3.x WebFlux Chat Application to demonstrate use of Reactive Redis [Pub/Sub] using
1313
Reactive [WebSocket Handler], without using any external Message Broker like RabbitMQ to sync messages between different
1414
instances.
1515

@@ -26,6 +26,9 @@ Additionally, the Docker Image for JVM base is available for AMD64 and ARM64 arc
2626
>1. [Spring-Boot 2.4.6: Java-11 Reactive JVM & GraalVM Native version](https://github.com/RawSanj/spring-redis-websocket/tree/spring-boot-webflux-graal-native-2.4.6)
2727
>2. [Spring-Boot 2.5.2: Java-11 Reactive JVM & GraalVM Native version](https://github.com/RawSanj/spring-redis-websocket/tree/spring-boot-webflux-graal-native-2.5.2)
2828
29+
> The older reactive spring-boot 3.2.x (java 17) based spring-redis-websocket application can be found in below:
30+
>1. [Spring-Boot 3.2.0: Java-11 Reactive JVM & GraalVM Native version](https://github.com/RawSanj/spring-redis-websocket/tree/spring-boot-webflux-graal-native-3.2.0)
31+
2932
### Deploy to Play-with-Docker
3033

3134
Ctrl + Click this button to deploy multiple instances of the spring-redis-websocket load balanced by [Traefik]:
@@ -50,8 +53,8 @@ Hence, this application is configured to use GraalVMVM native image tracing agen
5053
1. To run integration test which uses [Redis TestContainers](https://www.testcontainers.org/supported_docker_environment) so [Docker] should be configured properly to run [Testcontainers]
5154
2. You also need to install [GraalVMVM JDK](https://github.com/graalvm/graalvm-ce-builds/releases/tag/vm-22.3.0) and [native-image](https://www.graalvm.org/reference-manual/native-image) component:
5255
```sh
53-
$ sdk install java 22.3.r17-nik # Using [SDKMAN](https://sdkman.io/jdks) install GraalVMVM distribution of JDK
54-
$ sdk use java 22.3.r17-nik
56+
$ sdk install java 21.0.2-graalce # Using [SDKMAN](https://sdkman.io/jdks) install GraalVMVM distribution of JDK
57+
$ sdk use java 21.0.2-graalce
5558
```
5659

5760
##### Clone repo:
@@ -108,9 +111,9 @@ $ mvn -Pnative clean spring-boot:build-image
108111
Run docker image:
109112

110113
```sh
111-
$ docker run -d -p 8080:8080 rawsanj/spring-redis-websocket:3.2.0-jvm # JVM based Docker Image
114+
$ docker run -d -p 8080:8080 rawsanj/spring-redis-websocket:3.4.4-jvm # JVM based Docker Image
112115

113-
$ docker run -d -p 8080:8080 rawsanj/spring-redis-websocket:3.2.0-native # GraalVM Native Image based Docker Image
116+
$ docker run -d -p 8080:8080 rawsanj/spring-redis-websocket:3.4.4-native # GraalVM Native Image based Docker Image
114117
```
115118

116119
#### Run multiple instances using docker-compose locally
@@ -187,7 +190,7 @@ License
187190

188191
Apache License 2.0
189192

190-
Copyright (c) 2023 Sanjay Rawat
193+
Copyright (c) 2025 Sanjay Rawat
191194

192195
[//]: #
193196

build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash -i
2+
3+
shopt -s expand_aliases
24

35
# Runs Tests and Creates Docker Image based on Spring Graal Native Image
46
echo '**************************************************************'

pom.xml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55

66
<groupId>com.github.rawsanj</groupId>
77
<artifactId>spring-redis-websocket</artifactId>
8-
<version>3.2.0</version>
8+
<version>3.4.4</version>
99
<packaging>jar</packaging>
1010

1111
<name>spring-redis-websocket</name>
12-
<description>Spring Boot 3.x - Project for WebSocket Notification/Chat using Redis Pub/Sub - Java 17</description>
12+
<description>Spring Boot 3.x - Project for WebSocket Notification/Chat using Redis Pub/Sub - Java 21</description>
1313

1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>3.2.0</version>
17+
<version>3.4.4</version>
1818
<relativePath/> <!-- lookup parent from repository -->
1919
</parent>
2020

2121
<properties>
22-
<java.version>17</java.version>
22+
<java.version>21</java.version>
2323
<registry.image.name>rawsanj/spring-redis-websocket</registry.image.name>
2424
<skipNativeImage>true</skipNativeImage>
2525
</properties>
@@ -65,6 +65,12 @@
6565
<scope>test</scope>
6666
</dependency>
6767

68+
<dependency>
69+
<groupId>io.projectreactor.tools</groupId>
70+
<artifactId>blockhound</artifactId>
71+
<version>1.0.11.RELEASE</version>
72+
</dependency>
73+
6874
<dependency>
6975
<groupId>io.projectreactor</groupId>
7076
<artifactId>reactor-test</artifactId>
@@ -143,6 +149,14 @@
143149
</execution>
144150
</executions>
145151
</plugin>
152+
<plugin>
153+
<groupId>org.apache.maven.plugins</groupId>
154+
<artifactId>maven-surefire-plugin</artifactId>
155+
<version>2.22.2</version>
156+
<configuration>
157+
<argLine>-XX:+AllowRedefinitionToAddDeleteMethods</argLine>
158+
</configuration>
159+
</plugin>
146160
</plugins>
147161
</build>
148162
</profile>

src/main/docker/Dockerfile.jvm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM maven:3.8.8-eclipse-temurin-17 as build
1+
FROM maven:3.8.8-eclipse-temurin-21 as build
22
WORKDIR /app
33
COPY ../../.. ./
44
RUN mvn clean package --file pom.xml
55

6-
FROM eclipse-temurin:17-jdk-jammy
6+
FROM eclipse-temurin:21-jdk-alpine
77
ENV RUNTIME_PLATFORM=JVM
88
COPY --from=build /app/target/spring-redis-websocket-*.jar app.jar
99
ENTRYPOINT ["java","-jar","/app.jar"]

src/main/docker/Dockerfile.native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/graalvm/native-image-community:17 as build
1+
FROM ghcr.io/graalvm/native-image-community:21 as build
22
WORKDIR /app
33
COPY ../../.. ./
44
RUN ./mvnw -Pnative clean package -DskipNativeImage=false --file pom.xml

src/main/docker/docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ services:
3535
- 'redis_data:/bitnami/redis/data'
3636

3737
spring-chat-jvm:
38-
image: rawsanj/spring-redis-websocket:3.2.0-jvm
38+
image: rawsanj/spring-redis-websocket:3.4.4-jvm
3939
restart: unless-stopped
4040
labels:
4141
- traefik.http.routers.chat.rule=PathPrefix(`/`) || Host(`chat.docker.localhost`) # PathPrefix(`/`) rule is helpful when running on play-with-docker.com to access chat app directly on port 80
4242
- traefik.http.services.chat-service.loadbalancer.server.port=8080
4343
environment:
4444
- SPRING_DATA_REDIS_HOST=redis
4545
- SPRING_DATA_REDIS_PASSWORD=SuperSecretRedisPassword
46+
- RUNTIME_PLATFORM=JVM
4647
ports:
4748
- "8080"
4849
depends_on:
@@ -51,14 +52,15 @@ services:
5152
replicas: 2
5253

5354
spring-chat-native:
54-
image: rawsanj/spring-redis-websocket:3.2.0-native
55+
image: rawsanj/spring-redis-websocket:3.4.4-native
5556
restart: unless-stopped
5657
labels:
5758
- traefik.http.routers.chat.rule=PathPrefix(`/`) || Host(`chat.docker.localhost`) # PathPrefix(`/`) rule is helpful when running on play-with-docker.com to access chat app directly on port 80
5859
- traefik.http.services.chat-service.loadbalancer.server.port=8080
5960
environment:
6061
- SPRING_DATA_REDIS_HOST=redis
6162
- SPRING_DATA_REDIS_PASSWORD=SuperSecretRedisPassword
63+
- RUNTIME_PLATFORM=NATIVE
6264
ports:
6365
- "8080"
6466
depends_on:

src/main/k8s/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
spec:
1717
containers:
1818
- name: spring-redis-websocket
19-
image: rawsanj/spring-redis-websocket:3.2.0-jvm
19+
image: rawsanj/spring-redis-websocket:3.4.4-jvm
2020
resources:
2121
limits:
2222
memory: "512Mi"
@@ -48,7 +48,7 @@ spec:
4848
spec:
4949
containers:
5050
- name: spring-redis-websocket
51-
image: rawsanj/spring-redis-websocket:3.2.0-native
51+
image: rawsanj/spring-redis-websocket:3.4.4-native
5252
resources:
5353
limits:
5454
memory: "512Mi"

src/main/resources/application.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ spring:
88
management:
99
endpoint:
1010
health:
11-
enabled: true
11+
access: read_only
1212
show-details: always

src/main/resources/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ <h4><b>Messages:</b> <span id="req-id-no"> </span></h4>
133133
<a class="btn btn-warning float-center" href="https://rawsanj.dev" target="_blank"
134134
style="padding-bottom: 2px;">
135135
All rights reserved by @RawSanj. Copyright <i class="fa fa-copyright fa-6x" aria-hidden="true"></i>
136-
2020
136+
2025
137137
</a>
138138
</div>
139139
<div class="p-2 bd-highlight">

0 commit comments

Comments
 (0)