Skip to content

Commit f6fc7d5

Browse files
author
Piotr Kubicki
committed
Merge remote-tracking branch 'origin/feature/3-business-logic' into feature/4-services
2 parents c8cffc2 + 3931a1d commit f6fc7d5

File tree

11 files changed

+147
-102
lines changed

11 files changed

+147
-102
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@ updates:
99
directory: "/" # Root directory where pom.xml is located
1010
schedule:
1111
interval: "weekly" # Dependabot will check for updates every week
12-
open-pull-requests-limit: 5 # Optional: Limit the number of open PRs from Dependabot
12+
target-branch: "main"
13+
14+
- package-ecosystem: "maven"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"
18+
target-branch: "feature/5-security" # 👈 second branch config

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
with:
3838
name: surefire-failsafe-html-report
3939
path: target/reports/surefire.html
40-
retention-days: 90
40+
retention-days: 20

HELP.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# Read Me First
2-
The following was discovered as part of building this project:
3-
4-
* The original package name 'com.capgemini.training.appointment-booking-app' is invalid and this project uses 'com.capgemini.training.appointment_booking_app' instead.
5-
61
# Getting Started
72

83
### Reference Documentation

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ The repository grows in complexity and functionality across branches:
1616

1717
| Branch | Description |
1818
|--------|------------------------------------------------------------------------|
19-
| `main` | Base Spring Boot setup with basic health and H2 endpoints |
20-
| `feature/1-create-new-application` | Same as main |
19+
| `main` | Base Spring Boot setup with basic health endpoints |
20+
| `feature/1-create-new-application` | (Almost) same as main |
2121
| `feature/2-dataaccess` | Persistence layer with Spring Data JPA and H2, part 1 |
2222
| `feature/2-dataaccess-repositories` | Persistence layer with Spring Data JPA and H2, part 2 |
2323
| `feature/3-business-logic` | Service layer and business logic introduced |
@@ -31,7 +31,7 @@ After starting the application, you can access the following in your browser:
3131
| URL | Available from | Description |
3232
|-----|----------------|-------------|
3333
| [http://localhost:8080/actuator/health](http://localhost:8080/actuator/health) | `main` | Basic application health check |
34-
| [http://localhost:8080/h2-console](http://localhost:8080/h2-console) | `main` | In-memory H2 database console |
34+
| [http://localhost:8080/h2-console](http://localhost:8080/h2-console) | `feature/2-dataaccess` | In-memory H2 database console |
3535
| [http://localhost:8080/swagger-ui/index.html](http://localhost:8080/swagger-ui/index.html) | `feature/4-services` | OpenAPI UI for testing and exploring REST API |
3636

3737
## 🛠 Tech Stack

pom.xml

Lines changed: 100 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5,77 +5,74 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.4.4</version>
8+
<version>3.5.6</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.capgemini.training</groupId>
12-
<artifactId>appointment-booking-app</artifactId>
12+
<artifactId>appointment-booking</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<name>appointment-booking-app</name>
14+
<name>appointment-booking</name>
1515
<description>Demo project for Spring Boot</description>
16-
<url/>
17-
<licenses>
18-
<license/>
19-
</licenses>
20-
<developers>
21-
<developer/>
22-
</developers>
23-
<scm>
24-
<connection/>
25-
<developerConnection/>
26-
<tag/>
27-
<url/>
28-
</scm>
16+
2917
<properties>
3018
<java.version>21</java.version>
31-
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
19+
<org.mapstruct.version>1.6.3</org.mapstruct.version>
20+
<querydsl.version>5.1.0</querydsl.version>
21+
<maven-surefire-report-plugin.version>3.5.4</maven-surefire-report-plugin.version>
22+
<spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
3223
</properties>
3324
<dependencies>
25+
<!-- 1) Dependencies to run the application on web-server + features to help monitor and manage a Spring Boot application: -->
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-starter-test</artifactId>
29+
<scope>test</scope>
30+
</dependency>
3431
<dependency>
3532
<groupId>org.springframework.boot</groupId>
3633
<artifactId>spring-boot-starter-actuator</artifactId>
3734
</dependency>
38-
<dependency>
39-
<groupId>org.springframework.boot</groupId>
40-
<artifactId>spring-boot-starter-data-jpa</artifactId>
41-
</dependency>
4235
<dependency>
4336
<groupId>org.springframework.boot</groupId>
4437
<artifactId>spring-boot-starter-web</artifactId>
4538
</dependency>
39+
40+
<!-- 2) Dependencies to provide data access layer and H2 in-memory database: -->
41+
<dependency>
42+
<groupId>org.springframework.boot</groupId>
43+
<artifactId>spring-boot-starter-data-jpa</artifactId>
44+
</dependency>
45+
<dependency>
46+
<groupId>com.h2database</groupId>
47+
<artifactId>h2</artifactId>
48+
<scope>runtime</scope>
49+
</dependency>
4650
<dependency>
4751
<groupId>org.flywaydb</groupId>
4852
<artifactId>flyway-core</artifactId>
4953
</dependency>
50-
<dependency>
51-
<groupId>com.h2database</groupId>
52-
<artifactId>h2</artifactId>
53-
<version>2.2.224</version>
54-
<scope>runtime</scope>
55-
</dependency>
5654
<dependency>
5755
<groupId>org.projectlombok</groupId>
5856
<artifactId>lombok</artifactId>
5957
<scope>provided</scope>
6058
</dependency>
61-
<dependency>
62-
<groupId>org.springframework.boot</groupId>
63-
<artifactId>spring-boot-starter-test</artifactId>
64-
<scope>test</scope>
65-
</dependency>
59+
60+
<!-- 3) Query DSL advanced queries -->
6661
<dependency>
6762
<groupId>com.querydsl</groupId>
68-
<artifactId>querydsl-apt</artifactId>
69-
<version>5.1.0</version>
63+
<artifactId>querydsl-jpa</artifactId>
64+
<version>${querydsl.version}</version>
7065
<classifier>jakarta</classifier>
71-
<scope>provided</scope>
7266
</dependency>
7367
<dependency>
7468
<groupId>com.querydsl</groupId>
75-
<artifactId>querydsl-jpa</artifactId>
69+
<artifactId>querydsl-apt</artifactId>
70+
<version>${querydsl.version}</version>
7671
<classifier>jakarta</classifier>
77-
<version>5.1.0</version>
72+
<scope>provided</scope>
7873
</dependency>
74+
75+
<!-- 4) Mapstruct -->
7976
<dependency>
8077
<groupId>org.mapstruct</groupId>
8178
<artifactId>mapstruct</artifactId>
@@ -87,6 +84,8 @@
8784
<version>${org.mapstruct.version}</version>
8885
<scope>provided</scope>
8986
</dependency>
87+
88+
<!-- 5) spring-boot-starter-validation -->
9089
<dependency>
9190
<groupId>org.springframework.boot</groupId>
9291
<artifactId>spring-boot-starter-validation</artifactId>
@@ -114,13 +113,15 @@
114113

115114
<build>
116115
<plugins>
117-
<plugin>
118-
<groupId>org.apache.maven.plugins</groupId>
119-
<artifactId>maven-compiler-plugin</artifactId>
120-
<configuration>
121-
<release>${java.version}</release>
122-
</configuration>
123-
</plugin>
116+
<!--
117+
Not strictly mandatory, but in most Maven-based Spring Boot projects, it's highly recommended,
118+
because it simplifies packaging and deployment.
119+
The spring-boot-maven-plugin enables packaging the application as an executable JAR,
120+
which includes all dependencies and a manifest pointing to the main class.
121+
It simplifies running the app via `java -jar` and integrates with Maven's lifecycle.
122+
This plugin is essential for deploying Spring Boot applications and supports features
123+
like layered JARs for Docker and custom packaging.
124+
-->
124125
<plugin>
125126
<groupId>org.springframework.boot</groupId>
126127
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -133,6 +134,8 @@
133134
</excludes>
134135
</configuration>
135136
</plugin>
137+
138+
<!-- Optional, may be omitted: -->
136139
<plugin>
137140
<groupId>org.flywaydb</groupId>
138141
<artifactId>flyway-maven-plugin</artifactId>
@@ -143,15 +146,28 @@
143146
<cleanDisabled>false</cleanDisabled>
144147
</configuration>
145148
</plugin>
149+
150+
<!-- Unit tests -->
146151
<plugin>
147152
<groupId>org.apache.maven.plugins</groupId>
148153
<artifactId>maven-surefire-plugin</artifactId>
149-
<version>3.5.3</version>
154+
<configuration>
155+
<includes>
156+
<include>**/*Test.java</include>
157+
<include>**/*Tests.java</include>
158+
</includes>
159+
</configuration>
150160
</plugin>
161+
162+
<!-- Integration tests -->
151163
<plugin>
152164
<groupId>org.apache.maven.plugins</groupId>
153165
<artifactId>maven-failsafe-plugin</artifactId>
154-
<version>3.5.3</version>
166+
<configuration>
167+
<includes>
168+
<include>**/*IT.java</include>
169+
</includes>
170+
</configuration>
155171
<executions>
156172
<execution>
157173
<goals>
@@ -161,10 +177,12 @@
161177
</execution>
162178
</executions>
163179
</plugin>
180+
181+
<!-- Test reports (for CI pipeline) -->
164182
<plugin>
165183
<groupId>org.apache.maven.plugins</groupId>
166184
<artifactId>maven-surefire-report-plugin</artifactId>
167-
<version>3.5.3</version>
185+
<version>${maven-surefire-report-plugin.version}</version>
168186
<executions>
169187
<execution>
170188
<phase>verify</phase>
@@ -177,22 +195,8 @@
177195
<aggregate>true</aggregate>
178196
</configuration>
179197
</plugin>
180-
<plugin>
181-
<groupId>com.mysema.maven</groupId>
182-
<artifactId>apt-maven-plugin</artifactId>
183-
<version>1.1.3</version>
184-
<executions>
185-
<execution>
186-
<goals>
187-
<goal>process</goal>
188-
</goals>
189-
<configuration>
190-
<outputDirectory>target/generated-sources/java</outputDirectory>
191-
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
192-
</configuration>
193-
</execution>
194-
</executions>
195-
</plugin>
198+
199+
<!-- Spotless -->
196200
<plugin>
197201
<groupId>org.openapitools</groupId>
198202
<artifactId>openapi-generator-maven-plugin</artifactId>
@@ -239,7 +243,7 @@
239243
<plugin>
240244
<groupId>com.diffplug.spotless</groupId>
241245
<artifactId>spotless-maven-plugin</artifactId>
242-
<version>2.43.0</version>
246+
<version>${spotless-maven-plugin.version}</version>
243247
<configuration>
244248
<java>
245249
<removeUnusedImports/>
@@ -254,6 +258,38 @@
254258
</execution>
255259
</executions>
256260
</plugin>
261+
262+
<!-- Maven Compiler Plugin with QueryDSL -->
263+
<plugin>
264+
<groupId>org.apache.maven.plugins</groupId>
265+
<artifactId>maven-compiler-plugin</artifactId>
266+
<configuration>
267+
<annotationProcessorPaths>
268+
<path>
269+
<groupId>org.projectlombok</groupId>
270+
<artifactId>lombok</artifactId>
271+
<version>${lombok.version}</version>
272+
</path>
273+
<path>
274+
<groupId>org.mapstruct</groupId>
275+
<artifactId>mapstruct-processor</artifactId>
276+
<version>${org.mapstruct.version}</version>
277+
</path>
278+
<path>
279+
<groupId>com.querydsl</groupId>
280+
<artifactId>querydsl-apt</artifactId>
281+
<version>${querydsl.version}</version>
282+
<classifier>jakarta</classifier>
283+
</path>
284+
<path>
285+
<groupId>jakarta.persistence</groupId>
286+
<artifactId>jakarta.persistence-api</artifactId>
287+
<version>${jakarta-persistence.version}</version>
288+
</path>
289+
</annotationProcessorPaths>
290+
<generatedSourcesDirectory>target/generated-sources/annotations</generatedSourcesDirectory>
291+
</configuration>
292+
</plugin>
257293
</plugins>
258294
</build>
259295
</project>

src/main/java/com/capgemini/training/appointmentbooking/AppointmentBookingAppApplication.java renamed to src/main/java/com/capgemini/training/appointmentbooking/AppointmentBookingApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
55

66
@SpringBootApplication
7-
public class AppointmentBookingAppApplication {
7+
public class AppointmentBookingApplication {
88

99
public static void main(String[] args) {
10-
SpringApplication.run(AppointmentBookingAppApplication.class, args);
10+
SpringApplication.run(AppointmentBookingApplication.class, args);
1111
}
1212

1313
}

src/main/java/com/capgemini/training/appointmentbooking/logic/mapper/AppointmentCtoMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
@Mapper(uses = {AppointmentMapper.class, ClientMapper.class, TreatmentCtoMapper.class})
99
public interface AppointmentCtoMapper {
1010

11+
@Mapping(target = "version", ignore = true)
1112
@Mapping(source = "appointmentEto.id", target = "id")
1213
@Mapping(source = "appointmentEto.dateTime", target = "dateTime")
1314
@Mapping(source = "appointmentEto.status", target = "status")
1415
@Mapping(source = "appointmentEto.endsAt", target = "endsAt")
1516
@Mapping(source = "clientEto", target = "client")
1617
@Mapping(source = "treatmentCto", target = "treatment")
17-
@Mapping(target = "version", ignore = true)
18-
AppointmentEntity toEntity(AppointmentCto eto);
18+
AppointmentEntity toEntity(AppointmentCto cto);
1919

2020
@Mapping(source = "entity", target = "appointmentEto")
2121
@Mapping(source = "entity.client", target = "clientEto")

src/main/java/com/capgemini/training/appointmentbooking/logic/mapper/TreatmentCtoMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public interface TreatmentCtoMapper {
1414
@Mapping(source = "treatmentEto.durationMinutes", target = "durationMinutes")
1515
@Mapping(source = "specialistEto", target = "specialist")
1616
@Mapping(target = "version", ignore = true)
17-
TreatmentEntity toEntity(TreatmentCto entity);
17+
TreatmentEntity toEntity(TreatmentCto cto);
1818

1919
@Mapping(source = "entity", target = "treatmentEto")
2020
@Mapping(source = "entity.specialist", target = "specialistEto")
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
application.title=Appointment Booking Application
22

3-
spring.application.name=appointment-booking-app
3+
management.endpoint.health.show-components=always
4+
management.endpoint.health.show-details=always
5+
management.endpoints.web.exposure.include=*
6+
7+
spring.application.name=appointment-booking
48

59
spring.h2.console.enabled=true
610

711
spring.datasource.url=jdbc:h2:mem:appointmentbooking
812
spring.datasource.username=sa
913
spring.datasource.password=password
1014

11-
management.endpoint.health.show-components=always
12-
management.endpoint.health.show-details=always
13-
management.endpoints.web.exposure.include=*
14-
15-
spring.flyway.locations=classpath:db/migration
1615
spring.flyway.enabled=true
17-
spring.flyway.clean-on-validation-error=true
1816

17+
# Hibernate DDL-auto is recommended as 'none' when using Flyway for migrations
1918
spring.jpa.hibernate.ddl-auto=none
2019

20+
# To avoid potential lazy loading issues in the view layer, disable OSIV (Open Session in View) which is enabled by default in Spring Boot:
21+
spring.jpa.open-in-view=false
22+
23+
# Show SQL queries in logs for easier debugging (just for development purposes)
24+
spring.jpa.show-sql=true
25+
# To beautify or pretty-print the logged SQL (see above), we can add:
26+
spring.jpa.properties.hibernate.format_sql=true
27+
2128
spring.banner.location=classpath:/banner/jbd_banner.txt

0 commit comments

Comments
 (0)