Skip to content

Commit 0a0e3da

Browse files
author
Piotr Kubicki
committed
Merge remote-tracking branch 'origin/feature/2-dataaccess' into feature/2-dataaccess-repositories
# Conflicts: # pom.xml
2 parents ef19a4f + 13c6f18 commit 0a0e3da

File tree

9 files changed

+94
-71
lines changed

9 files changed

+94
-71
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: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,48 @@
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>
3119
</properties>
3220
<dependencies>
21+
<!-- 1) Dependencies to run the application on web-server + features to help monitor and manage a Spring Boot application: -->
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-test</artifactId>
25+
<scope>test</scope>
26+
</dependency>
3327
<dependency>
3428
<groupId>org.springframework.boot</groupId>
3529
<artifactId>spring-boot-starter-actuator</artifactId>
3630
</dependency>
37-
<dependency>
38-
<groupId>org.springframework.boot</groupId>
39-
<artifactId>spring-boot-starter-data-jpa</artifactId>
40-
</dependency>
4131
<dependency>
4232
<groupId>org.springframework.boot</groupId>
4333
<artifactId>spring-boot-starter-web</artifactId>
4434
</dependency>
35+
36+
<!-- 2) Dependencies to provide data access layer and H2 in-memory database: -->
37+
<dependency>
38+
<groupId>org.springframework.boot</groupId>
39+
<artifactId>spring-boot-starter-data-jpa</artifactId>
40+
</dependency>
41+
<dependency>
42+
<groupId>com.h2database</groupId>
43+
<artifactId>h2</artifactId>
44+
<scope>runtime</scope>
45+
</dependency>
4546
<dependency>
4647
<groupId>org.flywaydb</groupId>
4748
<artifactId>flyway-core</artifactId>
4849
</dependency>
49-
<dependency>
50-
<groupId>com.h2database</groupId>
51-
<artifactId>h2</artifactId>
52-
<version>2.2.224</version>
53-
<scope>runtime</scope>
54-
</dependency>
5550
<dependency>
5651
<groupId>org.projectlombok</groupId>
5752
<artifactId>lombok</artifactId>
@@ -79,13 +74,15 @@
7974

8075
<build>
8176
<plugins>
82-
<plugin>
83-
<groupId>org.apache.maven.plugins</groupId>
84-
<artifactId>maven-compiler-plugin</artifactId>
85-
<configuration>
86-
<release>${java.version}</release>
87-
</configuration>
88-
</plugin>
77+
<!--
78+
Not strictly mandatory, but in most Maven-based Spring Boot projects, it's highly recommended,
79+
because it simplifies packaging and deployment.
80+
The spring-boot-maven-plugin enables packaging the application as an executable JAR,
81+
which includes all dependencies and a manifest pointing to the main class.
82+
It simplifies running the app via `java -jar` and integrates with Maven's lifecycle.
83+
This plugin is essential for deploying Spring Boot applications and supports features
84+
like layered JARs for Docker and custom packaging.
85+
-->
8986
<plugin>
9087
<groupId>org.springframework.boot</groupId>
9188
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -108,15 +105,28 @@
108105
<cleanDisabled>false</cleanDisabled>
109106
</configuration>
110107
</plugin>
108+
109+
<!-- Unit tests -->
111110
<plugin>
112111
<groupId>org.apache.maven.plugins</groupId>
113112
<artifactId>maven-surefire-plugin</artifactId>
114-
<version>3.5.3</version>
113+
<configuration>
114+
<includes>
115+
<include>**/*Test.java</include>
116+
<include>**/*Tests.java</include>
117+
</includes>
118+
</configuration>
115119
</plugin>
120+
121+
<!-- Integration tests -->
116122
<plugin>
117123
<groupId>org.apache.maven.plugins</groupId>
118124
<artifactId>maven-failsafe-plugin</artifactId>
119-
<version>3.5.3</version>
125+
<configuration>
126+
<includes>
127+
<include>**/*IT.java</include>
128+
</includes>
129+
</configuration>
120130
<executions>
121131
<execution>
122132
<goals>
@@ -126,10 +136,12 @@
126136
</execution>
127137
</executions>
128138
</plugin>
139+
140+
<!-- Test reports (for CI pipeline) -->
129141
<plugin>
130142
<groupId>org.apache.maven.plugins</groupId>
131143
<artifactId>maven-surefire-report-plugin</artifactId>
132-
<version>3.5.3</version>
144+
<version>3.5.4</version>
133145
<executions>
134146
<execution>
135147
<phase>verify</phase>
@@ -158,6 +170,8 @@
158170
</execution>
159171
</executions>
160172
</plugin>
173+
174+
<!-- Spotless -->
161175
<plugin>
162176
<groupId>com.diffplug.spotless</groupId>
163177
<artifactId>spotless-maven-plugin</artifactId>

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
}
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

src/main/resources/db/migration/1.0/V0001__Create_schema.sql

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
CREATE TABLE USER_TABLE (
2-
ID NUMBER(19,0) NOT NULL,
2+
ID BIGINT NOT NULL,
33
VERSION INTEGER NOT NULL,
4-
EMAIL VARCHAR(128) NOT NULL,
4+
EMAIL VARCHAR(254) NOT NULL,
55
PASSWORD_HASH VARCHAR(128) NOT NULL,
6-
FIRST_NAME VARCHAR(128) NOT NULL,
7-
LAST_NAME VARCHAR(128) NOT NULL,
6+
FIRST_NAME VARCHAR(255) NOT NULL,
7+
LAST_NAME VARCHAR(255) NOT NULL,
88
CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
99
LAST_UPDATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1010
PRIMARY KEY (ID),
1111
CONSTRAINT UNIQUE_USER_EMAIL UNIQUE (EMAIL)
1212
);
1313

1414
CREATE TABLE CLIENT (
15-
ID NUMBER(19,0) NOT NULL,
15+
ID BIGINT NOT NULL,
1616
VERSION INTEGER NOT NULL,
17-
USER_ID NUMBER(19,0) NOT NULL,
17+
USER_ID BIGINT NOT NULL,
1818
CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1919
LAST_UPDATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
2020
PRIMARY KEY (ID),
2121
FOREIGN KEY (USER_ID) REFERENCES USER_TABLE(ID) ON DELETE CASCADE
2222
);
2323

2424
CREATE TABLE SPECIALIST (
25-
ID NUMBER(19,0) NOT NULL,
25+
ID BIGINT NOT NULL,
2626
VERSION INTEGER NOT NULL,
2727
SPECIALIZATION VARCHAR(128) NOT NULL,
28-
USER_ID NUMBER(19,0) NOT NULL,
28+
USER_ID BIGINT NOT NULL,
2929
CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
3030
LAST_UPDATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
3131
PRIMARY KEY (ID),
3232
FOREIGN KEY (USER_ID) REFERENCES USER_TABLE(ID) ON DELETE CASCADE
3333
);
3434

3535
CREATE TABLE TREATMENT (
36-
ID NUMBER(19,0) NOT NULL,
36+
ID BIGINT NOT NULL,
3737
VERSION INTEGER NOT NULL,
38-
NAME VARCHAR(256) NOT NULL,
39-
DESCRIPTION VARCHAR(1024),
38+
NAME VARCHAR(512) NOT NULL,
39+
DESCRIPTION TEXT,
4040
DURATION_MINUTES INTEGER NOT NULL,
41-
SPECIALIST_ID NUMBER(19,0) NOT NULL,
41+
SPECIALIST_ID BIGINT NOT NULL,
4242
CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
4343
LAST_UPDATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
4444
PRIMARY KEY (ID),
4545
FOREIGN KEY (SPECIALIST_ID) REFERENCES SPECIALIST(ID) ON DELETE CASCADE
4646
);
4747

4848
CREATE TABLE APPOINTMENT (
49-
ID NUMBER(19,0) NOT NULL,
49+
ID BIGINT NOT NULL,
5050
VERSION INTEGER NOT NULL,
5151
DATE_TIME TIMESTAMP NOT NULL,
5252
END_DATE_TIME TIMESTAMP NOT NULL,
5353
STATUS VARCHAR(128) NOT NULL DEFAULT 'SCHEDULED',
54-
CLIENT_ID NUMBER(19,0) NOT NULL,
55-
TREATMENT_ID NUMBER(19,0) NOT NULL,
54+
CLIENT_ID BIGINT NOT NULL,
55+
TREATMENT_ID BIGINT NOT NULL,
5656
CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
5757
LAST_UPDATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
5858
PRIMARY KEY (ID),

src/test/java/com/capgemini/training/appointmentbooking/AppointmentBookingAppApplicationIT.java renamed to src/test/java/com/capgemini/training/appointmentbooking/AppointmentBookingApplicationIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
import org.springframework.boot.test.context.SpringBootTest;
55

66
@SpringBootTest
7-
class AppointmentBookingAppApplicationIT {
7+
class AppointmentBookingApplicationIT {
88

99
@Test
1010
void contextLoads() {
11+
// loads application context
1112
}
1213

1314
}

0 commit comments

Comments
 (0)