This is a Java 17 / Maven 3 / Spring Boot (version 3.4.1) application that can be used as a reserving conference rooms in office.
This application is packaged as a jar which has Tomcat 8 embedded.
No Tomcat or JBoss installation is necessary. You run it using the java -jar
command.
- Import this repository into IDE
- Make sure you are using JDK 17 and Maven 3.x
- You can build the project and run the tests by running
mvn clean package
- Once successfully built, you can run the service by one of these two methods:
Right click on com.meetingrooms.MeetingRoomsServiceApplication, run the main class
mvn spring-boot:run -Drun.arguments="spring.profiles.active=local"
- Check the stdout to make sure no exceptions are thrown
Once the application runs you should see something like this
2025-01-12T17:14:15.580+04:00 INFO 22332 --- [Meeting Room Service] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
2025-01-12T17:14:15.596+04:00 INFO 22332 --- [Meeting Room Service] [ main] c.m.MeetingRoomsServiceApplication : Started MeetingRoomsServiceApplication in 8.189 seconds (process running for 9.094)
The service is just a simple room reservation REST service.
It uses an in-memory database (H2) to store the data.
You can also do with a relational database like MySQL or PostgreSQL.
If your database connection properties work, you can call some REST endpoints defined
in com.meetingrooms.reservations.api.ReservationsController
on port 8080. (see below)
- Make Reservations
curl --location 'localhost:8080/v1/reservations' \
--data '{
"capacity": 5,
"startDateTime": "2025-01-11 10:15",
"endDateTime": "2025-01-11 11:00"
}'
- Fetch Reservations
curl --location 'localhost:8080/v1/reservations?startDateTime=2025-01-11%2008%3A00&endDateTime=2025-01-11%2017%3A45'
The 'local' profile runs on H2 in-memory database.
To view and query the database you can browse to http://localhost:8080/h2-console.
Default username is 'sa' with a password password
.