This Spring Boot application manages a parking lot system, allowing users to track parked cars and their details.
- Java 17 or higher
- Docker and Docker Compose
- Gradle
-
Start the PostgreSQL database using Docker Compose:
docker-compose up -d
-
Build the application:
./gradlew clean build
-
Run the application:
./gradlew bootRun
The application will be available at http://localhost:8080
The application uses PostgreSQL with the following default configuration:
- Database: mydatabase
- Username: myuser
- Password: secret
- Port: 5432
You can modify these settings in application.properties
if needed.
The application includes Spring Boot Actuator endpoints for monitoring:
- Health check: http://localhost:8080/actuator/health
- Metrics: http://localhost:8080/actuator/metrics
- Prometheus metrics: http://localhost:8080/actuator/prometheus
erDiagram
Car {
Long id PK
String licensePlate
String brand
String model
String color
}
Parking {
Long id PK
String location
Integer capacity
}
ParkingSlot {
Long id PK
Long carId FK
Long parkingId FK
DateTime startTime
DateTime endTime
}
Car ||--o{ ParkingSlot : "occupies"
Parking ||--o{ ParkingSlot : "contains"
The API documentation is available through Swagger UI at:
- Swagger UI: http://localhost:8080/swagger-ui/index.html
- OpenAPI JSON: http://localhost:8080/v3/api-docs
The system supports the following operations:
- Register a car for parking (assigns an available parking slot)
- Register a car's departure (records when a car leaves the parking lot)
- Check if a specific car is currently in the parking lot
- Store car details (license plate, brand, model, color)
- Look up car information by license plate
- Track parking lot capacity
- Prevent parking when lot is full
- Monitor occupied and available parking slots
- Track parking duration for each car
- View parking lot occupancy status
- Access historical parking records