Spring Vacancy Management
Java Spring Boot application for vacancy and candidate management with intelligent ranking system. Features MongoDB integration, Docker deployment, comprehensive REST API, and smart candidate scoring based on configurable criteria.
Technologies Used
Project Documentation
from README.mdSpring Vacancy
Spring Vacancy is a comprehensive Java Spring Boot application for vacancy and candidate management with ranking capabilities. Built with Maven and containerized with Docker for easy deployment.
Features
- 🏢 Vacancy Management - Complete CRUD operations for job vacancies
- 👤 Candidate Management - Full candidate lifecycle management
- 🏆 Ranking System - Smart candidate ranking based on configurable criteria
- 📊 Criteria Scoring - Age, salary, and gender-based scoring algorithm
- 🐳 Docker Support - Containerized application with MongoDB
- 🔍 Search & Filter - Advanced search and filtering capabilities
- 📡 REST API - Comprehensive RESTful endpoints with consistent response format
Tech Stack
- Backend: Java 24, Spring Boot 3.5.5
- Database: MongoDB 7.0 with authentication
- Build Tool: Maven 3.9+
- Containerization: Docker & Docker Compose
- API Documentation: Built-in endpoint discovery
Getting Started
Prerequisites
- Java 24 or later
- Maven 3.9+
- Docker & Docker Compose (for containerized deployment)
Running the Application
Option 1: Using run.cmd (Recommended for Windows)
# Simply run the batch script
run.cmd
Note: We use run.cmd instead of mvn spring-boot:run due to ClassNotFoundException issues with the direct Maven command. The script builds a JAR and runs it directly, which resolves dependency conflicts.
Option 2: Manual JAR Execution
# Build the project
mvn clean package -DskipTests
# Run the JAR directly
java -jar target/vacancy-0.0.1-SNAPSHOT.jar
Option 3: Docker (Recommended for Production)
# Build and start all services (app + MongoDB + Mongo Express)
docker compose up --build
# Or run in background
docker compose up --build -d
# Stop services
docker compose down
Docker includes:
- Spring Boot application on
http://localhost:8080 - MongoDB database with authentication
- Mongo Express UI on
http://localhost:8081(admin/password)
Application URLs
- API Base:
http://localhost:8080/api - Health Check:
http://localhost:8080/api/health - API Documentation:
http://localhost:8080/api/info - Mongo Express (Docker only):
http://localhost:8081
API Endpoints
Health & Info
GET /api/health- Application health statusGET /api/info- Complete API documentation
Vacancy Management
GET /api/vacancy- List all vacanciesPOST /api/vacancy- Create new vacancyGET /api/vacancy/{id}- Get vacancy by IDPUT /api/vacancy/{id}- Update vacancyDELETE /api/vacancy/{id}- Delete vacancyGET /api/vacancy/code/{code}- Get by codeGET /api/vacancy/search/*- Various search options
Candidate Management
GET /api/candidate- List all candidatesPOST /api/candidate- Create new candidateGET /api/candidate/{id}- Get candidate by IDPUT /api/candidate/{id}- Update candidateDELETE /api/candidate/{id}- Delete candidateGET /api/candidate/email/{email}- Get by email
Ranking System
GET /api/ranking/{code}- Get ranked candidates for vacancyGET /api/ranking/{code}/summary- Get ranking statistics
Project Structure
Project Structure
spring-vacancy/
├── src/main/java/com/spring_vacancy/app/
│ ├── controller/ # REST Controllers
│ │ ├── VacancyController.java
│ │ ├── CandidateController.java
│ │ ├── RankingController.java
│ │ └── HealthController.java
│ ├── model/ # Data Models
│ │ ├── Vacancy.java
│ │ ├── Candidate.java
│ │ ├── Criteria.java
│ │ └── ApiResponse.java
│ ├── repository/ # MongoDB Repositories
│ ├── service/ # Business Logic
│ └── SpringVacancyApplication.java
├── docker-compose.yml # Docker services configuration
├── Dockerfile # Application container
├── run.cmd # Windows batch script for easy running
└── pom.xml # Maven dependencies
Development Notes
Why run.cmd instead of mvn spring-boot:run?
The direct Maven command mvn spring-boot:run causes ClassNotFoundException issues in this project. The run.cmd script solves this by:
- Building a complete JAR with all dependencies
- Running the JAR directly with
java -jar - Providing better error handling and debugging output
Docker Benefits
- Consistent Environment: Same setup across development/production
- Database Included: Pre-configured MongoDB with authentication
- Easy Management: Single command to start/stop everything
- No Local Setup: No need to install Java/Maven locally
Testing with Postman
📦 Ready-to-Import Collection
We provide a comprehensive Postman collection for easy API testing:
📁 Collection Location: postman/Spring Vacancy API.postman_collection.json
✨ Collection Features:
- 29 API Endpoints - Complete coverage of all controllers
- Sample Data - Pre-filled request bodies with realistic data
- Environment Variables - Configured for
localhost:8080 - Organized Folders - Grouped by functionality (Health, Vacancy, Candidate, Ranking)
- Response Tests - Built-in validation scripts
- Easy Import - Postman v2.1 format
🚀 How to Import:
- Open Postman
- Click Import (top left corner)
- Upload Files → Select
postman/Spring Vacancy API.postman_collection.json - Import → Collection appears in your workspace
- Start Testing! 🎉
📊 What's Included:
| Category | Endpoints | Description |
|---|---|---|
| 🏥 Health Check | 2 | Application status and API documentation |
| 🏢 Vacancy Management | 15 | Full CRUD + search & filter operations |
| 👤 Candidate Management | 10 | Complete candidate lifecycle |
| 🏆 Ranking System | 2 | Smart candidate scoring and statistics |
🔧 Pre-configured Variables:
baseUrl:http://localhost:8080- Sample IDs, names, and test data
- Realistic request examples
💡 Tip: Make sure your application is running before testing the endpoints!
License
This project is licensed under the MIT License.
Maven Commands Reference
# Compile the project
mvn compile
# Clean and compile
mvn clean compile
# Package into JAR
mvn package
# Run tests
mvn test
# Install to local repository
mvn install
# Note: mvn spring-boot:run has ClassNotFoundException issues
# Use run.cmd or java -jar target/vacancy-0.0.1-SNAPSHOT.jar instead