Skip to content

Commit ec2b775

Browse files
committed
Updated spring boot version to support 3.4.3 and spring cloud to 2024.0.0
1 parent 9349064 commit ec2b775

File tree

29 files changed

+185
-89
lines changed

29 files changed

+185
-89
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
/.idea/
1+
*.*
22
/Status
3+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Basic skeleton for Spring Boot Microservices. It includes spring security for ba
1616

1717
- Locate the docker directory from the root directory and run docker compose to startup the containers
1818
```
19-
cd docker && docker-compose up --build
19+
cd docker && docker compose up --build
2020
```
2121
![Docker Compose Build](https://github.com/Nasruddin/spring-boot-based-microservices/blob/master/images/docker-compose.png?raw=true)
2222

api/pom.xml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.6.6</version>
8+
<version>3.4.3</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>io.javatab.microservices.api</groupId>
1212
<artifactId>api</artifactId>
1313
<version>1.0.0</version>
14+
<packaging>jar</packaging>
1415
<name>api</name>
1516
<description>Demo project for Spring Boot</description>
1617
<properties>
@@ -41,11 +42,18 @@
4142
<build>
4243
<plugins>
4344
<plugin>
44-
<groupId>org.springframework.boot</groupId>
45-
<artifactId>spring-boot-maven-plugin</artifactId>
46-
<configuration>
47-
<classifier>exec</classifier>
48-
</configuration>
45+
<groupId>org.springframework.boot</groupId>
46+
<artifactId>spring-boot-maven-plugin</artifactId>
47+
<version>3.4.3</version> <!-- Match your Spring Boot version -->
48+
<executions>
49+
<execution>
50+
<id>repackage</id>
51+
<phase>none</phase>
52+
<goals>
53+
<goal>repackage</goal>
54+
</goals>
55+
</execution>
56+
</executions>
4957
</plugin>
5058
</plugins>
5159
</build>

api/src/test/java/io/javatab/microservices/api/ApiApplicationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.junit.jupiter.api.Test;
44
import org.springframework.boot.test.context.SpringBootTest;
55

6-
@SpringBootTest
6+
@SpringBootTest()
77
class ApiApplicationTests {
88

99
@Test

create-project.bash

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mkdir spring-boot-based-microservices
44
cd spring-boot-based-microservices
55

66
spring init \
7-
--boot-version=2.5.2 \
7+
--boot-version=3.4.3 \
88
--build=maven \
99
--java-version=17 \
1010
--packaging=jar \
@@ -16,7 +16,7 @@ spring init \
1616
student-service
1717

1818
spring init \
19-
--boot-version=2.5.2 \
19+
--boot-version=3.4.3 \
2020
--build=maven \
2121
--java-version=17 \
2222
--packaging=jar \
@@ -28,7 +28,7 @@ spring init \
2828
course-service
2929

3030
spring init \
31-
--boot-version=2.5.2 \
31+
--boot-version=3.4.3 \
3232
--build=maven \
3333
--java-version=17 \
3434
--packaging=jar \
@@ -40,7 +40,7 @@ spring init \
4040
vote-service
4141

4242
spring init \
43-
--boot-version=2.5.2 \
43+
--boot-version=3.4.3 \
4444
--build=maven \
4545
--java-version=17 \
4646
--packaging=jar \
@@ -52,7 +52,7 @@ spring init \
5252
search-service
5353

5454
spring init \
55-
--boot-version=2.5.2 \
55+
--boot-version=3.4.3 \
5656
--build=maven \
5757
--java-version=17 \
5858
--packaging=jar \

docker/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '2.1'
2-
31
services:
42
course:
53
build: ../microservices/course-service

images/build.png

452 KB
Loading

images/docker-compose.png

45.7 KB
Loading

images/docker-ps.png

388 KB
Loading
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# stage 1
22
# Start with a base image containing Java runtime
3-
# TODO :: Upgrade to slim jre version for 17 once available
4-
FROM openjdk:17-alpine as builder
3+
FROM eclipse-temurin:17-jre-alpine as builder
54
WORKDIR application
65
ARG JAR_FILE=target/*.jar
76
COPY ${JAR_FILE} application.jar
87
RUN java -Djarmode=layertools -jar application.jar extract
98

109
# the second stage of our build will copy the extracted layers
11-
FROM openjdk:17-alpine
10+
FROM eclipse-temurin:17-jre-alpine
1211
WORKDIR application
12+
# Copy extracted layers into the correct locations
1313
COPY --from=builder application/dependencies/ ./
1414
COPY --from=builder application/spring-boot-loader/ ./
1515
COPY --from=builder application/snapshot-dependencies/ ./
1616
COPY --from=builder application/application/ ./
1717

1818
EXPOSE 8080
1919

20-
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
20+
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]

microservices/course-composite-service/pom.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.0.5</version>
8+
<version>3.4.3</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>io.javatab.microservices.composite.course</groupId>
@@ -15,7 +15,7 @@
1515
<description>Demo project for Spring Boot</description>
1616
<properties>
1717
<java.version>17</java.version>
18-
<spring-cloud.version>2022.0.1</spring-cloud.version>
18+
<spring-cloud.version>2024.0.0</spring-cloud.version>
1919
</properties>
2020
<dependencies>
2121
<dependency>
@@ -118,8 +118,16 @@
118118
<build>
119119
<plugins>
120120
<plugin>
121-
<groupId>org.springframework.boot</groupId>
122-
<artifactId>spring-boot-maven-plugin</artifactId>
121+
<groupId>org.springframework.boot</groupId>
122+
<artifactId>spring-boot-maven-plugin</artifactId>
123+
<version>3.4.3</version> <!-- Match your Spring Boot version -->
124+
<executions>
125+
<execution>
126+
<goals>
127+
<goal>repackage</goal>
128+
</goals>
129+
</execution>
130+
</executions>
123131
</plugin>
124132
</plugins>
125133
</build>
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
# stage 1
22
# Start with a base image containing Java runtime
33
# TODO :: Upgrade to slim jre version for 17 once available
4-
FROM openjdk:17-alpine as builder
4+
FROM eclipse-temurin:17-jre-alpine AS builder
55
WORKDIR application
66
ARG JAR_FILE=target/*.jar
77
COPY ${JAR_FILE} application.jar
88
RUN java -Djarmode=layertools -jar application.jar extract
99

1010
# the second stage of our build will copy the extracted layers
11-
FROM openjdk:17-alpine
11+
FROM eclipse-temurin:17-jre-alpine
1212
WORKDIR application
13+
# Copy extracted layers into the correct locations
1314
COPY --from=builder application/dependencies/ ./
1415
COPY --from=builder application/spring-boot-loader/ ./
1516
COPY --from=builder application/snapshot-dependencies/ ./
1617
COPY --from=builder application/application/ ./
1718

19+
1820
EXPOSE 8080
1921

20-
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
22+
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]

microservices/course-service/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.0.5</version>
8+
<version>3.4.3</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>io.javatab.microservices.core.course</groupId>
@@ -16,7 +16,7 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<testcontainers.version>1.16.2</testcontainers.version>
19-
<spring-cloud.version>2022.0.1</spring-cloud.version>
19+
<spring-cloud.version>2024.0.0</spring-cloud.version>
2020
</properties>
2121
<dependencies>
2222
<dependency>
@@ -105,6 +105,11 @@
105105
<plugin>
106106
<groupId>org.springframework.boot</groupId>
107107
<artifactId>spring-boot-maven-plugin</artifactId>
108+
<configuration>
109+
<layers>
110+
<enabled>true</enabled>
111+
</layers>
112+
</configuration>
108113
</plugin>
109114
</plugins>
110115
</build>
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
# stage 1
22
# Start with a base image containing Java runtime
3-
# TODO :: Upgrade to slim jre version for 17 once available
4-
FROM openjdk:17-alpine as builder
3+
FROM eclipse-temurin:17-jre-alpine as builder
54
WORKDIR application
65
ARG JAR_FILE=target/*.jar
76
COPY ${JAR_FILE} application.jar
87
RUN java -Djarmode=layertools -jar application.jar extract
98

109
# the second stage of our build will copy the extracted layers
11-
FROM openjdk:17-alpine
10+
FROM eclipse-temurin:17-jre-alpine
1211
WORKDIR application
12+
# Copy extracted layers into the correct locations
1313
COPY --from=builder application/dependencies/ ./
1414
COPY --from=builder application/spring-boot-loader/ ./
1515
COPY --from=builder application/snapshot-dependencies/ ./
1616
COPY --from=builder application/application/ ./
1717

18+
1819
EXPOSE 8080
1920

20-
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
21+
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]

microservices/search-service/pom.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.0.5</version>
8+
<version>3.4.3</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>io.javatab.microservices.core.search</groupId>
@@ -16,7 +16,7 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<testcontainers.version>1.16.2</testcontainers.version>
19-
<spring-cloud.version>2022.0.1</spring-cloud.version>
19+
<spring-cloud.version>2024.0.0</spring-cloud.version>
2020
</properties>
2121
<dependencies>
2222
<dependency>
@@ -97,15 +97,17 @@
9797
</dependencies>
9898
</dependencyManagement>
9999

100-
101-
102100
<build>
103101
<plugins>
104102
<plugin>
105103
<groupId>org.springframework.boot</groupId>
106104
<artifactId>spring-boot-maven-plugin</artifactId>
105+
<configuration>
106+
<layers>
107+
<enabled>true</enabled>
108+
</layers>
109+
</configuration>
107110
</plugin>
108111
</plugins>
109112
</build>
110-
111113
</project>
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
# stage 1
22
# Start with a base image containing Java runtime
3-
# TODO :: Upgrade to slim jre version for 17 once available
4-
FROM openjdk:17-alpine as builder
3+
FROM eclipse-temurin:17-jre-alpine as builder
54
WORKDIR application
65
ARG JAR_FILE=target/*.jar
76
COPY ${JAR_FILE} application.jar
87
RUN java -Djarmode=layertools -jar application.jar extract
98

109
# the second stage of our build will copy the extracted layers
11-
FROM openjdk:17-alpine
10+
FROM eclipse-temurin:17-jre-alpine
1211
WORKDIR application
12+
# Copy extracted layers into the correct locations
1313
COPY --from=builder application/dependencies/ ./
1414
COPY --from=builder application/spring-boot-loader/ ./
1515
COPY --from=builder application/snapshot-dependencies/ ./
1616
COPY --from=builder application/application/ ./
1717

18+
1819
EXPOSE 8080
1920

20-
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
21+
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]

microservices/student-service/pom.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.0.5</version>
8+
<version>3.4.3</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>io.javatab.microservices.core.student</groupId>
@@ -16,7 +16,7 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<testcontainers.version>1.16.2</testcontainers.version>
19-
<spring-cloud.version>2022.0.1</spring-cloud.version>
19+
<spring-cloud.version>2024.0.0</spring-cloud.version>
2020
</properties>
2121
<dependencies>
2222
<dependency>
@@ -102,8 +102,16 @@
102102
<build>
103103
<plugins>
104104
<plugin>
105-
<groupId>org.springframework.boot</groupId>
106-
<artifactId>spring-boot-maven-plugin</artifactId>
105+
<groupId>org.springframework.boot</groupId>
106+
<artifactId>spring-boot-maven-plugin</artifactId>
107+
<version>3.4.3</version> <!-- Match your Spring Boot version -->
108+
<executions>
109+
<execution>
110+
<goals>
111+
<goal>repackage</goal>
112+
</goals>
113+
</execution>
114+
</executions>
107115
</plugin>
108116
</plugins>
109117
</build>

microservices/vote-service/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
# stage 1
22
# Start with a base image containing Java runtime
3-
# TODO :: Upgrade to slim jre version for 17 once available
4-
FROM openjdk:17-alpine as builder
3+
FROM eclipse-temurin:17-jre-alpine as builder
54
WORKDIR application
65
ARG JAR_FILE=target/*.jar
76
COPY ${JAR_FILE} application.jar
87
RUN java -Djarmode=layertools -jar application.jar extract
98

109
# the second stage of our build will copy the extracted layers
11-
FROM openjdk:17-alpine
10+
FROM eclipse-temurin:17-jre-alpine
1211
WORKDIR application
12+
# Copy extracted layers into the correct locations
1313
COPY --from=builder application/dependencies/ ./
1414
COPY --from=builder application/spring-boot-loader/ ./
1515
COPY --from=builder application/snapshot-dependencies/ ./
1616
COPY --from=builder application/application/ ./
1717

18+
1819
EXPOSE 8080
1920

20-
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
21+
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]

0 commit comments

Comments
 (0)