A comprehensive university management system built with Spring Boot, featuring student registration, department management, and email notifications.
- Docker and Docker Compose installed
- Git
-
Clone the repository
git clone <your-repo-url> cd springboot
-
Run with Docker Compose
docker-compose up --build
-
Access the application
- Application: http://localhost:8080
- Health check: http://localhost:8080/actuator/health
- PostgreSQL: localhost:5432
# Build the image
docker build -t spring-boot-app .
# Run the container
docker run -p 8080:8080 spring-boot-app-
Push your code to GitHub
git add . git commit -m "Add Docker configuration for Render deployment" git push origin main
-
Connect to Render
- Go to Render Dashboard
- Click "New +" → "Blueprint"
- Connect your GitHub repository
- Render will automatically detect the
render.yamlfile
-
Configure Environment Variables
- In the Render dashboard, go to your service
- Navigate to "Environment" tab
- Update sensitive values like database passwords and email credentials
-
Create a new Web Service
- Go to Render Dashboard
- Click "New +" → "Web Service"
- Connect your GitHub repository
-
Configure the service
- Build Command: Leave empty (Docker handles this)
- Start Command: Leave empty (Docker handles this)
- Environment: Docker
- Dockerfile Path:
./Dockerfile - Docker Context:
.
-
Set Environment Variables
SPRING_DATASOURCE_URL=your_postgresql_url SPRING_DATASOURCE_USERNAME=your_username SPRING_DATASOURCE_PASSWORD=your_password SPRING_MAIL_USERNAME=your_email@gmail.com SPRING_MAIL_PASSWORD=your_app_password SERVER_PORT=10000
springboot/
├── src/main/java/com/example/spring/
│ ├── Application.java # Main application class
│ ├── controller/ # REST controllers
│ ├── dto/ # Data Transfer Objects
│ ├── entity/ # JPA entities
│ ├── repository/ # Data repositories
│ └── service/ # Business logic services
├── src/main/resources/
│ └── application.properties # Application configuration
├── Dockerfile # Docker configuration
├── docker-compose.yml # Local development setup
├── render.yaml # Render deployment config
├── .dockerignore # Docker ignore file
└── pom.xml # Maven configuration
The application supports the following environment variables:
| Variable | Description | Default |
|---|---|---|
SPRING_DATASOURCE_URL |
Database connection URL | PostgreSQL URL from properties |
SPRING_DATASOURCE_USERNAME |
Database username | From properties |
SPRING_DATASOURCE_PASSWORD |
Database password | From properties |
SPRING_MAIL_USERNAME |
Email username | From properties |
SPRING_MAIL_PASSWORD |
Email app password | From properties |
SERVER_PORT |
Application port | 8080 |
SPRING_PROFILES_ACTIVE |
Active profile | production |
The application uses PostgreSQL and includes:
- Student management
- Department management
- Course enrollment
- Library management
- Hostel management
- User authentication
Configured for Gmail SMTP with:
- Student registration notifications
- OTP verification
- System notifications
The application includes Spring Boot Actuator for health monitoring:
- Health endpoint:
/actuator/health - Info endpoint:
/actuator/info
- Database credentials are stored in environment variables
- Email credentials should be secured in production
- The application runs as a non-root user in Docker
- Health checks are configured for container orchestration
POST /api/students- Register new studentGET /api/students- Get all studentsPOST /api/departments- Create departmentGET /api/departments- Get all departmentsPOST /api/verify-otp- Verify OTP
-
Database Connection Failed
- Check database URL and credentials
- Ensure PostgreSQL is running
- Verify network connectivity
-
Email Service Not Working
- Verify Gmail app password
- Check SMTP settings
- Ensure 2FA is enabled on Gmail
-
Docker Build Fails
- Check Dockerfile syntax
- Verify all dependencies in pom.xml
- Ensure Java 21 is available
View application logs:
# Docker Compose
docker-compose logs -f spring-app
# Docker
docker logs <container-id>For issues and questions, please check the application logs and ensure all environment variables are properly configured.