File tree 29 files changed +185
-89
lines changed
src/test/java/io/javatab/microservices/api 29 files changed +185
-89
lines changed Original file line number Diff line number Diff line change 1
- / .idea /
1
+ * . *
2
2
/Status
3
+
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ Basic skeleton for Spring Boot Microservices. It includes spring security for ba
16
16
17
17
- Locate the docker directory from the root directory and run docker compose to startup the containers
18
18
```
19
- cd docker && docker- compose up --build
19
+ cd docker && docker compose up --build
20
20
```
21
21
![ Docker Compose Build] ( https://github.com/Nasruddin/spring-boot-based-microservices/blob/master/images/docker-compose.png?raw=true )
22
22
Original file line number Diff line number Diff line change 5
5
<parent >
6
6
<groupId >org.springframework.boot</groupId >
7
7
<artifactId >spring-boot-starter-parent</artifactId >
8
- <version >2.6.6 </version >
8
+ <version >3.4.3 </version >
9
9
<relativePath /> <!-- lookup parent from repository -->
10
10
</parent >
11
11
<groupId >io.javatab.microservices.api</groupId >
12
12
<artifactId >api</artifactId >
13
13
<version >1.0.0</version >
14
+ <packaging >jar</packaging >
14
15
<name >api</name >
15
16
<description >Demo project for Spring Boot</description >
16
17
<properties >
41
42
<build >
42
43
<plugins >
43
44
<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 >
49
57
</plugin >
50
58
</plugins >
51
59
</build >
Original file line number Diff line number Diff line change 3
3
import org .junit .jupiter .api .Test ;
4
4
import org .springframework .boot .test .context .SpringBootTest ;
5
5
6
- @ SpringBootTest
6
+ @ SpringBootTest ()
7
7
class ApiApplicationTests {
8
8
9
9
@ Test
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ mkdir spring-boot-based-microservices
4
4
cd spring-boot-based-microservices
5
5
6
6
spring init \
7
- --boot-version=2.5.2 \
7
+ --boot-version=3.4.3 \
8
8
--build=maven \
9
9
--java-version=17 \
10
10
--packaging=jar \
@@ -16,7 +16,7 @@ spring init \
16
16
student-service
17
17
18
18
spring init \
19
- --boot-version=2.5.2 \
19
+ --boot-version=3.4.3 \
20
20
--build=maven \
21
21
--java-version=17 \
22
22
--packaging=jar \
@@ -28,7 +28,7 @@ spring init \
28
28
course-service
29
29
30
30
spring init \
31
- --boot-version=2.5.2 \
31
+ --boot-version=3.4.3 \
32
32
--build=maven \
33
33
--java-version=17 \
34
34
--packaging=jar \
@@ -40,7 +40,7 @@ spring init \
40
40
vote-service
41
41
42
42
spring init \
43
- --boot-version=2.5.2 \
43
+ --boot-version=3.4.3 \
44
44
--build=maven \
45
45
--java-version=17 \
46
46
--packaging=jar \
@@ -52,7 +52,7 @@ spring init \
52
52
search-service
53
53
54
54
spring init \
55
- --boot-version=2.5.2 \
55
+ --boot-version=3.4.3 \
56
56
--build=maven \
57
57
--java-version=17 \
58
58
--packaging=jar \
Original file line number Diff line number Diff line change 1
- version : ' 2.1'
2
-
3
1
services :
4
2
course :
5
3
build : ../microservices/course-service
Original file line number Diff line number Diff line change 1
1
# stage 1
2
2
# 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
5
4
WORKDIR application
6
5
ARG JAR_FILE=target/*.jar
7
6
COPY ${JAR_FILE} application.jar
8
7
RUN java -Djarmode=layertools -jar application.jar extract
9
8
10
9
# the second stage of our build will copy the extracted layers
11
- FROM openjdk :17-alpine
10
+ FROM eclipse-temurin :17-jre -alpine
12
11
WORKDIR application
12
+ # Copy extracted layers into the correct locations
13
13
COPY --from=builder application/dependencies/ ./
14
14
COPY --from=builder application/spring-boot-loader/ ./
15
15
COPY --from=builder application/snapshot-dependencies/ ./
16
16
COPY --from=builder application/application/ ./
17
17
18
18
EXPOSE 8080
19
19
20
- ENTRYPOINT ["java" , "org.springframework.boot.loader.JarLauncher" ]
20
+ ENTRYPOINT ["java" , "org.springframework.boot.loader.launch. JarLauncher" ]
Original file line number Diff line number Diff line change 5
5
<parent >
6
6
<groupId >org.springframework.boot</groupId >
7
7
<artifactId >spring-boot-starter-parent</artifactId >
8
- <version >3.0.5 </version >
8
+ <version >3.4.3 </version >
9
9
<relativePath /> <!-- lookup parent from repository -->
10
10
</parent >
11
11
<groupId >io.javatab.microservices.composite.course</groupId >
15
15
<description >Demo project for Spring Boot</description >
16
16
<properties >
17
17
<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>
19
19
</properties >
20
20
<dependencies >
21
21
<dependency >
118
118
<build >
119
119
<plugins >
120
120
<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 >
123
131
</plugin >
124
132
</plugins >
125
133
</build >
Original file line number Diff line number Diff line change 1
1
# stage 1
2
2
# Start with a base image containing Java runtime
3
3
# 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
5
5
WORKDIR application
6
6
ARG JAR_FILE=target/*.jar
7
7
COPY ${JAR_FILE} application.jar
8
8
RUN java -Djarmode=layertools -jar application.jar extract
9
9
10
10
# the second stage of our build will copy the extracted layers
11
- FROM openjdk :17-alpine
11
+ FROM eclipse-temurin :17-jre -alpine
12
12
WORKDIR application
13
+ # Copy extracted layers into the correct locations
13
14
COPY --from=builder application/dependencies/ ./
14
15
COPY --from=builder application/spring-boot-loader/ ./
15
16
COPY --from=builder application/snapshot-dependencies/ ./
16
17
COPY --from=builder application/application/ ./
17
18
19
+
18
20
EXPOSE 8080
19
21
20
- ENTRYPOINT ["java" , "org.springframework.boot.loader.JarLauncher" ]
22
+ ENTRYPOINT ["java" , "org.springframework.boot.loader.launch. JarLauncher" ]
Original file line number Diff line number Diff line change 5
5
<parent >
6
6
<groupId >org.springframework.boot</groupId >
7
7
<artifactId >spring-boot-starter-parent</artifactId >
8
- <version >3.0.5 </version >
8
+ <version >3.4.3 </version >
9
9
<relativePath /> <!-- lookup parent from repository -->
10
10
</parent >
11
11
<groupId >io.javatab.microservices.core.course</groupId >
16
16
<properties >
17
17
<java .version>17</java .version>
18
18
<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>
20
20
</properties >
21
21
<dependencies >
22
22
<dependency >
105
105
<plugin >
106
106
<groupId >org.springframework.boot</groupId >
107
107
<artifactId >spring-boot-maven-plugin</artifactId >
108
+ <configuration >
109
+ <layers >
110
+ <enabled >true</enabled >
111
+ </layers >
112
+ </configuration >
108
113
</plugin >
109
114
</plugins >
110
115
</build >
Original file line number Diff line number Diff line change 1
1
# stage 1
2
2
# 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
5
4
WORKDIR application
6
5
ARG JAR_FILE=target/*.jar
7
6
COPY ${JAR_FILE} application.jar
8
7
RUN java -Djarmode=layertools -jar application.jar extract
9
8
10
9
# the second stage of our build will copy the extracted layers
11
- FROM openjdk :17-alpine
10
+ FROM eclipse-temurin :17-jre -alpine
12
11
WORKDIR application
12
+ # Copy extracted layers into the correct locations
13
13
COPY --from=builder application/dependencies/ ./
14
14
COPY --from=builder application/spring-boot-loader/ ./
15
15
COPY --from=builder application/snapshot-dependencies/ ./
16
16
COPY --from=builder application/application/ ./
17
17
18
+
18
19
EXPOSE 8080
19
20
20
- ENTRYPOINT ["java" , "org.springframework.boot.loader.JarLauncher" ]
21
+ ENTRYPOINT ["java" , "org.springframework.boot.loader.launch. JarLauncher" ]
Original file line number Diff line number Diff line change 5
5
<parent >
6
6
<groupId >org.springframework.boot</groupId >
7
7
<artifactId >spring-boot-starter-parent</artifactId >
8
- <version >3.0.5 </version >
8
+ <version >3.4.3 </version >
9
9
<relativePath /> <!-- lookup parent from repository -->
10
10
</parent >
11
11
<groupId >io.javatab.microservices.core.search</groupId >
16
16
<properties >
17
17
<java .version>17</java .version>
18
18
<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>
20
20
</properties >
21
21
<dependencies >
22
22
<dependency >
97
97
</dependencies >
98
98
</dependencyManagement >
99
99
100
-
101
-
102
100
<build >
103
101
<plugins >
104
102
<plugin >
105
103
<groupId >org.springframework.boot</groupId >
106
104
<artifactId >spring-boot-maven-plugin</artifactId >
105
+ <configuration >
106
+ <layers >
107
+ <enabled >true</enabled >
108
+ </layers >
109
+ </configuration >
107
110
</plugin >
108
111
</plugins >
109
112
</build >
110
-
111
113
</project >
Original file line number Diff line number Diff line change 1
1
# stage 1
2
2
# 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
5
4
WORKDIR application
6
5
ARG JAR_FILE=target/*.jar
7
6
COPY ${JAR_FILE} application.jar
8
7
RUN java -Djarmode=layertools -jar application.jar extract
9
8
10
9
# the second stage of our build will copy the extracted layers
11
- FROM openjdk :17-alpine
10
+ FROM eclipse-temurin :17-jre -alpine
12
11
WORKDIR application
12
+ # Copy extracted layers into the correct locations
13
13
COPY --from=builder application/dependencies/ ./
14
14
COPY --from=builder application/spring-boot-loader/ ./
15
15
COPY --from=builder application/snapshot-dependencies/ ./
16
16
COPY --from=builder application/application/ ./
17
17
18
+
18
19
EXPOSE 8080
19
20
20
- ENTRYPOINT ["java" , "org.springframework.boot.loader.JarLauncher" ]
21
+ ENTRYPOINT ["java" , "org.springframework.boot.loader.launch. JarLauncher" ]
Original file line number Diff line number Diff line change 5
5
<parent >
6
6
<groupId >org.springframework.boot</groupId >
7
7
<artifactId >spring-boot-starter-parent</artifactId >
8
- <version >3.0.5 </version >
8
+ <version >3.4.3 </version >
9
9
<relativePath /> <!-- lookup parent from repository -->
10
10
</parent >
11
11
<groupId >io.javatab.microservices.core.student</groupId >
16
16
<properties >
17
17
<java .version>17</java .version>
18
18
<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>
20
20
</properties >
21
21
<dependencies >
22
22
<dependency >
102
102
<build >
103
103
<plugins >
104
104
<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 >
107
115
</plugin >
108
116
</plugins >
109
117
</build >
Original file line number Diff line number Diff line change 1
1
# stage 1
2
2
# 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
5
4
WORKDIR application
6
5
ARG JAR_FILE=target/*.jar
7
6
COPY ${JAR_FILE} application.jar
8
7
RUN java -Djarmode=layertools -jar application.jar extract
9
8
10
9
# the second stage of our build will copy the extracted layers
11
- FROM openjdk :17-alpine
10
+ FROM eclipse-temurin :17-jre -alpine
12
11
WORKDIR application
12
+ # Copy extracted layers into the correct locations
13
13
COPY --from=builder application/dependencies/ ./
14
14
COPY --from=builder application/spring-boot-loader/ ./
15
15
COPY --from=builder application/snapshot-dependencies/ ./
16
16
COPY --from=builder application/application/ ./
17
17
18
+
18
19
EXPOSE 8080
19
20
20
- ENTRYPOINT ["java" , "org.springframework.boot.loader.JarLauncher" ]
21
+ ENTRYPOINT ["java" , "org.springframework.boot.loader.launch. JarLauncher" ]
You can’t perform that action at this time.
0 commit comments