Quiz application built with Spring Boot. Admins create and manage questions. Users answer quizzes and get scored results. Form-based authentication with role-based access control.
./mvnw spring-boot:runOpen http://localhost:8080. Register an ADMIN account to create questions, or a USER account to take the quiz.
No need to install Java or Maven locally.
Option A - Clone from GitHub:
git clone https://github.com/DJAngel973/Final-Project-IBM-SpringBoot
cd questionnaireOption B - Download ZIP:
- Download the project ZIP from GitHub
- Extract and navigate to the folder:
cd questionnairedocker build -t questionnaire-app .What happens here:
- Maven downloads dependencies and compiles the code
- Creates a lightweight production-ready image (~300MB)
- Multi-stage build ensures optimal size
docker run -d -p 8080:8080 --name questionnaire questionnaire-appCommand breakdown:
-d→ Runs in background (detached mode)-p 8080:8080→ Maps container port 8080 to your machine's port 8080--name questionnaire→ Assigns a friendly name to the container
Open your browser: http://localhost:8080
-
Create an Admin Account:
- Click "Register here"
- Username:
admin - Password:
tesTS$#gy123. - Email:
admin@test.com - Role: Administrator
-
Create Questions (Admin):
- Login with admin credentials
- You'll be redirected to Quiz List
- Click "Add Questionnaire"
- Enter question text and 4 answer options
- Select the correct answer
- Click "Add Question"
-
Test as Regular User:
- Logout (top-right corner)
- Register a new account with role User
- Login → you'll be redirected to the quiz
- Select your answers
- Click "Submit Answers"
- View your score and results
# Check if container is running
docker ps
# View application logs
docker logs questionnaire
# View logs in real-time
docker logs -f questionnaire
# Stop the container
docker stop questionnaire
# Start the container again
docker start questionnaire
# Restart the container
docker restart questionnaire
# Remove the container (must stop first)
docker stop questionnaire
docker rm questionnaire
# Remove the image
docker rmi questionnaire-appProblem: Port 8080 already in use
# Use a different port (e.g., 9090)
docker run -d -p 9090:8080 --name questionnaire questionnaire-app
# Then access via http://localhost:9090Problem: Container won't start
# Check the logs for errors
docker logs questionnaireProblem: Need to rebuild after code changes
docker stop questionnaire
docker rm questionnaire
docker rmi questionnaire-app
docker build -t questionnaire-app .
docker run -d -p 8080:8080 --name questionnaire questionnaire-appCreate a docker-compose.yml file:
version: '3.8'
services:
app:
build: .
ports:
- "8080:8080"
container_name: questionnaire
restart: unless-stoppedThen use these simple commands:
# Start the application
docker-compose up -d
# Stop the application
docker-compose down
# View logs
docker-compose logs -f
# Rebuild and restart
docker-compose up -d --build| URL | Access | Description |
|---|---|---|
/ |
Public | Landing page |
/login |
Public | Login form |
/register |
Public | User registration |
/quizlist/** |
ADMIN | Manage questions (CRUD) |
/quiz |
USER | Answer the quiz |
/quiz/results |
USER | View score and results |
After login, users are redirected based on role: ADMIN → /quizlist, USER → /quiz.
src/
├── main/java/com/app/questionnaire/
│ ├── config/
│ │ └── WebSecurityConfig.java # Security filter chain & BCrypt
│ ├── controller/
│ │ └── QuestionController.java # All endpoints
│ ├── model/
│ │ ├── Question.java
│ │ ├── Role.java # ADMIN, USER
│ │ └── User.java
│ ├── service/
│ │ ├── QuestionsService.java # Question CRUD & answer validation
│ │ └── QuizUserDetailsService.java # UserDetailsService & registration
│ └── QuestionnaireApplication.java
├── main/resources/
│ ├── static/css/ # Per-page stylesheets
│ ├── templates/ # Thymeleaf views
│ └── application.properties
└── test/
└── QuestionnaireApplicationTests.java
- Java 21
- Spring Boot 3.4.2
- Spring Security (form login, BCrypt, session-based auth)
- Thymeleaf + Thymeleaf Spring Security extras
- Maven
- In-memory storage
- Docker (multi-stage build for production deployment)
This project is open source and available for educational purposes.
This is a Coursera final project, but contributions, issues, and feature requests are welcome for learning purposes!
If you have questions or need help running the project:
- Check the Docker troubleshooting section above
- Review the application logs:
docker logs questionnaire - Open an issue on GitHub
Academic project demonstrating Spring Boot, Spring Security, Thymeleaf, Docker.