A modern course registration and management system built with Spring Boot 3, Java 21, and containerized with Docker.
- Complete CRUD Operations - Create, Read, Update, Delete for courses, students, and users
- Access Control List (ACL) - Role-based security with Spring Security
- User Authentication - Secure login system with encrypted passwords
- Form Validation - Server-side validation for data integrity
- Responsive Design - Bootstrap-based UI that works on all devices
- RESTful Architecture - Clean and maintainable code structure
- Docker Support - Easy deployment with Docker Compose
- Database Flexibility - Support for both PostgreSQL and MySQL
- Docker 20.10+
- Docker Compose 2.0+
- Java JDK 21 (LTS)
- Maven 3.9+
- PostgreSQL 12+ or MySQL 5.7+
- Backend: Java 21, Spring Boot 3.3.4
- Persistence: Spring Data JPA, Hibernate
- Security: Spring Security 6
- Template Engine: Thymeleaf
- Build Tool: Maven 3.9+
- Database: PostgreSQL 16 / MySQL 8
- Frontend: Bootstrap 5, CSS3
- Containerization: Docker, Docker Compose
The easiest way to run the application with all dependencies:
# Clone the repository
git clone https://github.com/dalmosantos/java-spring-boot.git
cd java-spring-boot
# Start all services (app + PostgreSQL)
docker-compose up -d
# Or use the convenience script
./docker-run.sh startThe application will be available at: http://localhost:8080
Default Credentials:
- Username: admin
- Password: admin
Additional User:
- Username: user
- Password: user
For detailed Docker commands and troubleshooting, see DOCKER.md
git clone https://github.com/dalmosantos/java-spring-boot.git
cd java-spring-bootFor PostgreSQL:
# Connect to PostgreSQL
psql -U postgres
# Create database and import schema
CREATE DATABASE springcourse;
\c springcourse
\i spring_course_postgres.sql
\qFor MySQL:
# Connect to MySQL
mysql -u root -p
# Create database and import schema
CREATE DATABASE spring_course;
USE spring_course;
SOURCE spring_course.sql;
exit;Edit src/main/resources/application.properties:
For PostgreSQL:
spring.datasource.url=jdbc:postgresql://localhost:5432/springcourse
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialectFor MySQL:
spring.datasource.url=jdbc:mysql://localhost:3306/spring_course
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL8DialectEnsure Java 21 is installed and configured:
# Set JAVA_HOME (Linux/Mac)
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
export PATH="$JAVA_HOME/bin:$PATH"
# Verify installation
java -version# Build the project
mvn clean package
# Run the application
mvn spring-boot:run
# Or run the JAR directly
java -jar target/spring-course-1.0.jarAccess the application at: http://localhost:8080
java-spring-boot/
├── src/
│   ├── main/
│   │   ├── java/course/
│   │   │   ├── controller/      # MVC Controllers
│   │   │   ├── entity/          # JPA Entities
│   │   │   ├── repository/      # Data Access Layer
│   │   │   ├── service/         # Business Logic
│   │   │   ├── WebSecurityConfig.java
│   │   │   └── CrudbootApplication.java
│   │   └── resources/
│   │       ├── templates/       # Thymeleaf templates
│   │       ├── static/          # CSS, JS, fonts
│   │       └── application.properties
│   └── test/                    # Unit tests
├── docker-compose.yml           # Docker orchestration
├── Dockerfile                   # Container image
├── pom.xml                      # Maven configuration
└── docker-run.sh               # Convenience script
The application comes with two pre-configured users:
| Username | Password | Role | Permissions | 
|---|---|---|---|
| admin | admin | ADMIN | Full access | 
| user | user | USER | Limited access | 
Note: Change these credentials in production!
# Start services
./docker-run.sh start
# View application logs
./docker-run.sh logs-app
# View database logs
./docker-run.sh logs-db
# Restart services
./docker-run.sh restart
# Stop services
./docker-run.sh stop
# Rebuild application
./docker-run.sh rebuild
# Access PostgreSQL console
./docker-run.sh psql
# View container status
./docker-run.sh status
# Clean up everything
./docker-run.sh cleanRun the test suite:
# Run all tests
mvn test
# Run tests with coverage
mvn test jacoco:report
# Skip tests during build
mvn clean package -DskipTestsThe application manages three main entities:
- Course - Course information (ID, name)
- Student - Student details (ID, name, email, department)
- User - Authentication (ID, username, password, role)
- Student_Course - Many-to-many relationship between students and courses
Key configuration options in application.properties:
# Server port
server.port=8080
# Database connection
spring.datasource.url=jdbc:postgresql://localhost:5432/springcourse
spring.datasource.username=springcourse
spring.datasource.password=springcourse123
# JPA/Hibernate
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
# Thymeleaf
spring.thymeleaf.cache=falseYou can override settings using environment variables:
SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/springcourse
SPRING_DATASOURCE_USERNAME=springcourse
SPRING_DATASOURCE_PASSWORD=springcourse123
SPRING_JPA_HIBERNATE_DDL_AUTO=update- Update docker-compose.ymlwith production settings
- Set strong passwords in environment variables
- Configure proper volumes for data persistence
- Deploy:
docker-compose -f docker-compose.yml up -d- 
Build the JAR: mvn clean package -DskipTests 
- 
Run with production profile: java -jar target/spring-course-1.0.jar --spring.profiles.active=prod 
- Passwords are encrypted using BCrypt
- CSRF protection enabled
- Role-based access control (RBAC)
- SQL injection prevention via JPA
- XSS protection via Thymeleaf escaping
- Fork the repository
- Create a feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This project includes comprehensive GitHub Actions workflows for continuous integration and deployment:
- Build and Test - Automatic testing and building on every push/PR
- Docker Build and Push - Automated Docker image building and publishing to GitHub Container Registry
- Deploy - Manual deployment to different environments (dev/staging/production)
- Release - Automated release creation when tags are pushed
# Build and test automatically triggered on push
git push origin main
# Create a release
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0
# Deploy manually via GitHub Actions UI
# Go to Actions → Deploy Application → Run workflow# Pull the latest image
docker pull ghcr.io/dalmosantos/java-spring-boot:latest
# Run the container
docker run -p 8080:8080 ghcr.io/dalmosantos/java-spring-boot:latestFor detailed deployment instructions, see:
- 📖 Deployment Guide - Complete guide for deployment
- 🛠️ Commands Reference - Useful commands and scripts
Original Developer: Danilo Meneghel
- Email: danilo.meneghel@gmail.com
- Website: http://danilomeneghel.github.io/
Current Maintainer: dalmosantos
- Repository: https://github.com/dalmosantos/java-spring-boot
- Spring Framework team for excellent documentation
- Thymeleaf for the powerful template engine
- Bootstrap for responsive UI components
- The open-source community
 Student registration and editing
Student registration and editing
 Student profile and enrolled courses
Student profile and enrolled courses
If you find this project useful, please consider giving it a star!





