Spring Boot REST API • Oracle DB • JdbcTemplate
A production-structured Spring Boot REST application that performs full CRUD operations on student records stored in an Oracle Pluggable Database (PDB). Designed to mirror real enterprise Java backends — with a clean layered architecture, environment-aware configuration via Spring Profiles, structured logging with Log4j, and both REST API and Thymeleaf-based web interfaces.
| Layer | Package | Responsibility |
|---|---|---|
| Controller | com.shrivardhan.college.controller |
Exposes REST endpoints and web MVC routes |
| Service | com.shrivardhan.college.service |
Business logic, validation, exception handling |
| Repository | com.shrivardhan.college.repository |
JdbcTemplate SQL queries against Oracle PDB |
| Model | com.shrivardhan.college.model |
Java objects for DB row mapping |
| Technology | Details |
|---|---|
| Java | 25 (via Gradle toolchain) |
| Spring Boot | 4.0.1 — embedded Tomcat |
| Spring JDBC | JdbcTemplate — explicit SQL, no ORM overhead |
| Oracle DB | Oracle PDB 21c (ojdbc11:23.3.0.23.09) |
| Thymeleaf | Server-side HTML templating |
| Log4j | Structured application logging |
| Gradle | Build tool |
| Spring Profiles | Environment-specific configuration (dev / prod) |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/viewStudents |
List students with pagination (?page=0&size=10) |
GET |
/api/viewStudents/count |
Return total student count |
GET |
/api/GetStudent/{id} |
Retrieve a student by ID |
POST |
/api/insertStudent |
Insert a new student (JSON body) |
PUT |
/api/updateStudent |
Update student name and age (JSON body) |
GET |
/api/deleteStudent/{id} |
Delete a student by ID |
- Java 25+
- Gradle 8+
- Oracle Database PDB accessible on the network
git clone https://github.com/shrivardhan/college-student-management.git
cd college-student-managementEdit the appropriate profile config under src/main/resources/:
# application-dev.yml
spring:
datasource:
url: jdbc:oracle:thin:@//192.168.0.120:1521/ORCLPDB
username: dev_user
password: dev_pass
driver-class-name: oracle.jdbc.OracleDriverCREATE TABLE student (
id NUMBER PRIMARY KEY,
name VARCHAR2(100),
age NUMBER
);# Run with dev profile
./gradlew bootRun --args='--spring.profiles.active=dev'
# Or build a JAR
./gradlew build
java -jar build/libs/college-1.0-SNAPSHOT.jar --spring.profiles.active=prod- REST API:
http://localhost:8080/api - Web UI:
http://localhost:8080/web/viewStudents
A global @RestControllerAdvice returns structured JSON error responses:
| Exception | HTTP Status | When Thrown |
|---|---|---|
StudentAlreadyExistsException |
409 CONFLICT | Student ID already exists |
StudentNotFoundException |
404 NOT FOUND | Requested ID does not exist |
DataAccessResourceFailureException |
503 UNAVAILABLE | Cannot reach Oracle DB |
| Profile | Config File | For |
|---|---|---|
| default | application.yml |
Shared / fallback |
| dev | application-dev.yml |
Local development VM |
| prod | application-prod.yml |
Production Oracle PDB |
Runs across two Virtual Machines:
- VM 1 (Linux): Oracle Database PDB — listener on port
1521 - VM 2 (Windows): Spring Boot app — connects to remote Oracle PDB via JDBC
src/main/java/com/shrivardhan/college/
├── controller/
├── service/
├── repository/
├── model/
└── exception/
src/main/resources/
├── features/
├── static/
├── application.yml
├── application-dev.yml
├── application-prod.yml
└── templates/