FitZoneSpring is a command-line Spring Boot application for managing gym client records. This document provides a high-level introduction to the application's purpose, technology stack, and architectural design.
Relevant source files:
.gitattributespom.xmlsrc/main/java/fit_zone/fit_zone/FitZoneSpringApplication.javasrc/main/resources/application.properties
FitZoneSpring is a console-based Spring Boot application designed to manage client records for a gym facility. The application provides a command-line interface for performing CRUD (Create, Read, Update, Delete) operations on client data stored in a MySQL database. Unlike typical Spring Boot applications that serve web requests, FitZoneSpring is configured to run as a standalone console application that executes immediately upon startup via the CommandLineRunner interface.
The application allows gym staff to:
- List all registered clients
- Search for a specific client by ID
- Add new client records with membership information
- Modify existing client details
- Delete client records
FitZoneSpring is built using the following technologies and frameworks:
| Component | Technology | Version | Purpose |
|---|---|---|---|
| Runtime | Java | 17 | Application runtime environment |
| Framework | Spring Boot | 4.0.0 | Application framework and dependency injection |
| Persistence | Spring Data JPA | (via starter) | Data access layer abstraction |
| ORM | Hibernate | (via JPA starter) | Object-relational mapping provider |
| Database | MySQL | 8.0 | Relational database for client data storage |
| JDBC Driver | MySQL Connector/J | (runtime) | Database connectivity |
| Code Generation | Lombok | (compile-time) | Boilerplate code reduction |
| Build Tool | Maven | 3.9.11 (via wrapper) | Dependency management and build automation |
| Logging | SLF4J/Logback | (via Spring Boot) | Application logging |
| CI/CD | Jenkins | N/A | Continuous integration pipeline |
FitZoneSpring follows a classic three-tier layered architecture, with clear separation between the presentation layer (console UI), business logic layer (services), and data access layer (repositories).
Component Hierarchy:
- Presentation Layer:
FitZoneSpringApplication(CLI Interface) - Business Logic Layer:
ClientService/IClientService - Data Access Layer:
ClientRepository(Spring Data JPA) - Domain Model:
Client(JPA Entity)
The application provides an interactive console menu with the following operations:
| Menu Option | Service Method Called | Description |
|---|---|---|
| 1 | listClients() |
Displays all registered clients |
| 2 | findClientById(Integer) |
Retrieves a specific client by ID |
| 3 | saveClient(Client) |
Creates a new client record |
| 4 | findClientById() + saveClient() |
Updates existing client information |
| 5 | findClientById() + deleteClient() |
Deletes a client record |
| 6 | N/A | Exits the application |
The application is configured through application.properties with several critical settings:
- Database Connection: JDBC URL pointing to MySQL at
127.0.0.1:3306/fit_zone_dbwith credentialsroot/admin - Schema Management:
spring.jpa.hibernate.ddl-auto=noneprevents automatic schema generation - Web Disabled:
spring.main.web-application-type=nonedisables the embedded web server - Naming Strategy:
PhysicalNamingStrategyStandardImplpreserves exact field names
The Client entity uses JPA annotations to map Java objects to the clients database table:
| Java Field | Java Type | Database Column | Constraints |
|---|---|---|---|
| idClient | Integer | idClient | Primary Key, Auto-increment |
| firstName | String | first_name | NOT NULL |
| lastName1 | String | last_name1 | NOT NULL |
| lastName2 | String | last_name2 | NOT NULL |
| membershipNumber | Integer | membership_number | UNIQUE |
The ClientRepository interface extends JpaRepository<Client, Integer>, providing automatic implementations for standard CRUD operations.
The application is built using Maven, with the Maven Wrapper ensuring consistent builds across environments:
- Build Command:
./mvnw clean packageormvnw.cmd clean package(Windows) - Output Artifact:
target/fit_zone-0.0.1-SNAPSHOT.jar(executable JAR with embedded dependencies) - Execution:
java -jar target/fit_zone-0.0.1-SNAPSHOT.jar - CI/CD: Jenkins pipeline defined in
Jenkinsfileautomates build, test, and package stages
The spring-boot-maven-plugin creates a "fat JAR" containing all dependencies, making the application self-contained and deployable without additional setup beyond Java 17 and MySQL 8.0.
For detailed information on specific aspects of FitZoneSpring, refer to the complete documentation covering:
- Setting up the development environment
- Understanding the architectural layers
- Component documentation
- Configuration options
- Build system details
- Database schema reference