This is a Spring Boot application demonstrating basic CRUD operations for a student management system. The application includes features such as creating, reading, updating, and deleting student records.
- CRUD Operations:
- Create a new student.
- Retrieve all students or a specific student by ID.
- Update an existing student's details.
- Delete a student.
- Spring Boot Configuration: Includes application properties and dependency management using Maven.
- Layered Architecture:
- Controller Layer: Handles HTTP requests and responses.
- Service Layer: Contains business logic.
- Repository Layer: Interacts with the database.
- Example Student Entity: Demonstrates the use of JPA for object-relational mapping.
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com.example.demo
│ │ │ ├── DemoApplication.java
│ │ │ ├── student
│ │ │ ├── Student.java
│ │ │ ├── StudentController.java
│ │ │ ├── StudentService.java
│ │ │ ├── StudentRepository.java
│ │ │ ├── StudentConfig.java
│ │ ├── resources
│ │ ├── application.properties
│ └── test
│ └── java
│ └── com.example.demo
│ ├── DemoApplicationTests.java
├── .gitignore
├── mvnw
├── mvnw.cmd
├── pom.xml
- Java: Ensure you have JDK 11 or higher installed.
- Maven: Verify that Maven is installed and added to your PATH.
- Database: This project is set up for H2 Database by default. Modify
application.propertiesto configure other databases.
-
Clone the repository:
git clone https://github.com/Kipkiruie/Springboot.git cd Springboot -
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
-
Access the application:
- API documentation (if using Swagger):
http://localhost:8080/swagger-ui.html - Example endpoint:
http://localhost:8080/api/v1/students
- API documentation (if using Swagger):
Modify the src/main/resources/application.properties file to customize the database connection, server port, and other settings.
Example:
# Server configuration
server.port=8080
# Database configuration
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect- Spring Boot: Framework for building Java-based web applications.
- Spring Data JPA: Simplifies data access layers.
- H2 Database: In-memory database for testing and development.
- Maven: Build and dependency management tool.
This project is licensed under the MIT License. Feel free to use and modify it.
For any questions or feedback, feel free to contact Elisha Ng'etich.