A modern Spring Boot application built with Kotlin, featuring a responsive web interface and REST API endpoints.
- Modern Tech Stack: Spring Boot 3.5.3, Kotlin 2.2.10, Java 21 LTS
- Responsive UI: Bootstrap 5.3.3 with modern design
- REST API: JSON endpoints with timestamp support
- Health Monitoring: Spring Boot Actuator for application health
- Live Development: Spring Boot DevTools for automatic reload
- Interactive HTTP Debugging: Client-side HTTP request/response visualization
- Containerization: Docker support with multi-stage builds
- Comprehensive Testing: Unit, integration, and MVC tests
- Modern Kotlin: Constructor injection, data classes, and modern syntax
- Backend: Spring Boot 3.5.3
- Language: Kotlin 2.2.10
- Java Version: 21 LTS
- Frontend: Bootstrap 5.3.3, Thymeleaf
- Build Tool: Gradle 9.0.0
- Testing: JUnit 5, AssertJ, MockMvc
- Containerization: Docker
- Java 21 or higher
- Gradle 9.0.0 or higher
- Docker (optional)
-
Clone the repository
git clone <repository-url> cd template-lab1-git-race
-
Build the application
./gradlew build
-
Run the application
./gradlew bootRun
-
Access the application
- Web Interface: http://localhost:8080
- API Endpoint: http://localhost:8080/api/hello
- Health Check: http://localhost:8080/actuator/health
-
Using Docker Compose (Recommended):
docker-compose -f docker-compose.dev.yml up --build
-
Build and run development container:
docker build -f Dockerfile.dev -t modern-web-app-dev . docker run -p 8080:8080 -p 35729:35729 -v $(pwd):/app modern-web-app-dev
The development Docker setup includes:
- LiveReload Support: Automatic browser refresh on code changes
- Volume Mounting: Source code changes are immediately reflected
- Spring Boot DevTools: Automatic application restart on file changes
- Health Monitoring: Built-in health checks via Spring Boot Actuator
Run all tests:
./gradlew testRun specific test classes:
./gradlew test --tests "HelloControllerUnitTests"
./gradlew test --tests "IntegrationTest"GET /- Main web page with interactive HTTP debugging toolsGET /?name={name}- Personalized greeting page
GET /api/hello- Returns JSON greeting with timestampGET /api/hello?name={name}- Returns personalized JSON greeting
GET /actuator/health- Application health statusGET /actuator/info- Application informationGET /actuator/metrics- Application metrics
- Web Page Testing: Test the main page with personalized greetings
- API Testing: Test REST endpoints with real-time request/response display
- Health Check Testing: Monitor application health status
- Live Reload: Spring Boot DevTools automatically reloads on file changes
src/
├── main/
│ ├── kotlin/
│ │ ├── controller/
│ │ │ └── HelloController.kt # Web and API controllers
│ │ └── HelloWorld.kt # Main application class
│ └── resources/
│ ├── application.properties # Application configuration
│ ├── templates/
│ │ └── welcome.html # Thymeleaf template
│ └── public/
│ └── assets/
│ └── logo.svg # Application logo
└── test/
└── kotlin/
├── controller/
│ ├── HelloControllerUnitTests.kt # Unit tests
│ └── HelloControllerMVCTests.kt # MVC tests
└── IntegrationTest.kt # Integration tests
Key configuration options in application.properties:
# Application settings
spring.application.name=modern-web-app
server.port=8080
# Custom message
app.message=Welcome to the Modern Web App!
# Actuator endpoints
management.endpoints.web.exposure.include=health,info,metricsThe application includes a development-focused Docker setup:
- Development Dockerfile: Uses JDK 21 Alpine for development with live reload
- Docker Compose: Orchestrates the development environment with volume mounting
- LiveReload: Spring Boot DevTools automatically reloads on file changes
- Volume Mounting: Source code changes are immediately reflected in the container
- Health Checks: Built-in health monitoring via Spring Boot Actuator
- Development Tools: Includes wget for health checks and debugging utilities
- Controllers: Add new endpoints in the controller package
- Templates: Add new Thymeleaf templates in
src/main/resources/templates/ - Tests: Add corresponding tests in the test package
- Configuration: Update
application.propertiesfor new settings
- Use modern Kotlin features (constructor injection, data classes)
- Follow Spring Boot best practices
- Write comprehensive tests for all functionality
- Use descriptive test method names with backticks
The application includes Spring Boot Actuator for monitoring:
- Health: Application and dependency health status
- Info: Application metadata and build information
- Metrics: JVM and application metrics
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- ✅ Upgraded to Java 21 LTS for better performance
- ✅ Modern Kotlin syntax with constructor injection
- ✅ Separated web and API controllers for better organization
- ✅ Added comprehensive test coverage
- ✅ Implemented Spring Boot Actuator for monitoring
- ✅ Created responsive Bootstrap 5.3.3 UI
- ✅ Added Docker support with multi-stage builds
- ✅ Fixed Bootstrap version inconsistencies
- ✅ Enhanced error handling and validation
- ✅ Added interactive features and API endpoints