A Spring Boot + MySQL + Thymeleaf demo web app. Students pick their branch and target role, enter the skills they already have, and get a skill-gap percentage plus study links (YouTube / Coursera / free resources) for every missing skill.
- Spring Web (MVC + REST endpoint for AJAX)
- Spring JDBC (
JdbcTemplate— no JPA/Hibernate) - Thymeleaf (server-side templates)
- MySQL Driver
- Bootstrap 5 (via CDN link in each template's
<head>— no npm/build step needed)
skill-gap-analyzer/
├── pom.xml
├── src/main/java/com/skillgap/analyzer/
│ ├── SkillGapAnalyzerApplication.java
│ ├── model/ (Role, GapResult, SkillCourse, User, AnalysisHistory, RoleStat, AdminAnalysisView)
│ ├── repository/ (RoleRepository, UserRepository, AnalysisHistoryRepository — plain JDBC)
│ ├── service/ (SkillGapService - gap calculation logic, unchanged)
│ ├── security/ (PasswordUtil - salted SHA-256 hashing)
│ ├── config/ (AuthInterceptor, AdminInterceptor, WebConfig)
│ └── controller/ (SkillGapController, AuthController, AdminController)
└── src/main/resources/
├── application.properties
├── schema.sql (roles table resets every startup; users/analysis_history do not)
├── data.sql (auto-run on every startup, ~90 roles across 11 branches)
├── templates/
│ ├── index.html, result.html, history.html (regular users)
│ ├── login.html, register.html
│ ├── admin.html (admin only)
│ └── fragments/footer.html (shared History/Logout/Admin footer)
└── static/css/style.css (small overrides layered on top of Bootstrap CDN)
- Register / Login / Logout — session-based auth (no Spring Security
dependency needed). Passwords are stored as salted SHA-256 hashes
(
security/PasswordUtil.java). For a real production app, swap this forspring-boot-starter-security+BCryptPasswordEncoder. - Protected pages —
/,/analyze,/api/roles, and/historyall require login. AnAuthInterceptor(seeconfig/) redirects anyone without a session to/login. - Persistent history — every analysis you run is saved to
analysis_history, tied to your account, and shown on the new My History page (most recent first). The homepage also shows a quick preview of your last 3 analyses with a "View all" link, so your history is visible right away without an extra click. - Most Searched Role preview — the homepage shows a "🔥 Most Searched
Role" card: the single role analyzed most often across all users,
computed with a read-only
GROUP BY / COUNTquery (AnalysisHistoryRepository.findMostSearchedRole()), along with its core required skills. This is purely a read aggregation over existing history rows — it doesn't create, edit, or move any data. - Past analyses are never altered.
AnalysisHistoryRepositoryonly everINSERTs new rows — there is no update/delete path — and theusers/analysis_historytables useCREATE TABLE IF NOT EXISTS(notDROP TABLE), so restarting the app never wipes accounts or previously saved reports. Only the read-onlyrolesreference table is reset on startup, exactly as before. - The skill-gap calculation itself is untouched —
SkillGapService.analyze()is called exactly as before; the controller just also saves the result afterward.
- Every page now uses Bootstrap 5 loaded from the CDN
(
https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css) — no build step, no npm, just a<link>in each template's<head>. - History and Logout buttons moved to the footer — every page now
shares a single footer fragment (
templates/fragments/footer.html), included withth:replace="~{fragments/footer :: appFooter}", so the History/Logout/Admin buttons look and behave identically everywhere. - Admin-only dashboard (
/admin) — shows a table of every user's analyses (name, email, role, branch, match %, gap %, missing skills, timestamp) plus a "Top Searched Roles" ranking. This is powered byAnalysisHistoryRepository.findAllWithUser(), a read-only join acrossanalysis_historyandusers. - Locked down with two interceptors (
config/AuthInterceptor+config/AdminInterceptor): a logged-out visitor is redirected to/login; a logged-in but non-admin user is redirected to/if they try to reach anything under/admin/**. Regular users still only ever see their own history at/history— never other users' data. - How to make a user an admin: there's no signup flow for admins on
purpose (keeps it safe by default). Register a normal account, then
promote it directly in MySQL:
Log out and back in afterward so the session picks up the change.
UPDATE users SET is_admin = TRUE WHERE email = 'you@example.com';
- Top Searched Role preview stays on the analyzer page (the homepage) for all users, unchanged — the admin dashboard additionally shows the full top-10 ranking, not just the single winner.
- JDK 17+
- Maven (or use the included
mvnwif you generate one via Spring Initializr / your IDE) - MySQL Server running locally
You don't need to create tables manually — schema.sql and data.sql run
automatically on startup. You only need the database itself to exist:
CREATE DATABASE IF NOT EXISTS skillgap_db;(The datasource URL also has createDatabaseIfNotExist=true as a safety net.)
Edit src/main/resources/application.properties:
spring.datasource.username=root
spring.datasource.password=your_mysql_passwordcd skill-gap-analyzer
mvn spring-boot:runThen open: http://localhost:8080
GET /loads distinct branches from therolestable into a dropdown.- Selecting a branch fires a
fetch()call toGET /api/roles?branch=..., which returns JSON and repopulates the role dropdown — no page reload. - Submitting the form (
POST /analyze) with branch, role, and the student's comma-separated skills:- Looks up the role's required skills from MySQL.
- Case-insensitively compares them against what the student entered.
- Calculates match % and gap %.
- Builds YouTube / Coursera / free-resource search links for every missing skill (generated dynamically, so all ~90 roles / 200+ skills are covered without hardcoding a course catalogue).
result.htmlrenders the report with a progress bar, matched skills, and clickable study links for missing skills.
- Add a
studentstable + login to save each student's analysis history. - Add a
skill_coursestable if you want curated (not auto-generated) links. - Add a REST-only API layer (
@RestController) if you want a separate frontend (React/Angular) instead of Thymeleaf.