- Introduction
- Key Features
- GitHub Actions Pipelines Integration
- How to Start the Project
- Provided Examples with Implementation on Spring Boot
- Branches
- Git Commit Plugin Response
Welcome to the Spring Boot Best Practices Application! This project serves as a comprehensive demonstration of fundamental Java Spring concepts, highlighting industry best practices and essential techniques for building robust Spring Boot applications. The project is designed to be a reference for developers of all levels, providing examples of a wide range of Spring Boot features and implementations.
- Model-View-Controller (MVC) Architecture: Embracing the MVC pattern for a well-organized and modular structure.
- MapStruct for Object Mapping: Streamlining object mapping for enhanced readability and maintainability.
- Flyway for Database Migration: Seamless database migration management through Flyway.
- JUnit 5 Configuration: Configured JUnit 5 for effective testing and robust code coverage.
- JSON Data Processing: Efficiently reading and filtering data from JSON files.
- Basic CRUD Operations: Implementation of essential CRUD operations for effective resource management.
- Pageable Response Handling: Demonstrating easy filtering, sorting, and more with Pageable responses.
- Global Exception Handling: A global exception handler for managing exceptions across the codebase.
- Custom Spring Validator: Examples of custom Spring validators at field and class levels.
- CriteriaBuilder for Data Retrieval: Using CriteriaBuilder for advanced data retrieval.
- Spring Boot Actuator: Configuring Spring Boot Actuator for collecting application metrics.
- Git Information Injection: Injecting Git information into Spring for version tracking.
- Quartz Scheduler: Implementation of Quartz scheduler using Cron Triggers and Expressions.
- Spring Custom Events: Leveraging Spring Custom Events for event-driven architecture.
- Integrated with GitHub Actions for code analyses with SonarCloud and Codecov for code coverage reports.
- Integrated with Docker. On every push event to the main branch, a new Docker image is generated.
- Integrated with Maven Dependency tree generation.
- Codecov Example (example of how to set up Codecov badge)
- Codecov Dashboard
- Clone the repository.
- Start the local PostgreSQL.
- Run Maven clean install.
- Open the Swagger URL to test the endpoints: Swagger UI
- Open Spring Boot Actuator endpoint: Actuator
- Pageable and Sorting Response: Baeldung Tutorial → ( controller package)
- Flyway: Baeldung Tutorial → (resources.db.migration package)
- JUNIT5: Baeldung Tutorial → (tests package)
- Global Exception Handler in Java: Baeldung Tutorial → ( advice package)
- CriteriaBuilder: Baeldung Tutorial → (repository.custom package and CriteriaBuilderExampleController)
- Custom Validator: Baeldung Tutorial → (validator package)
- Spring Boot Actuator: Baeldung Tutorial
- Injecting Git Information Into Spring: Baeldung Tutorial → ( HistoryLinkProvidingGitInfoContributor.class)
- Quartz Job Scheduler with Cron Triggers and Expressions: Quartz Scheduler → ( configuration.quartz package)
- Spring Custom Events: Baeldung Tutorial → (event package)
- Branch with name: "java11Version" is set up for JDK11
- Main branch is with the newest spring boot 3.0.2 and JDK17
// 20221101225521
// http://localhost:8099/actuator/info
{
"git": {
"commit": {
"message": {
"short": "Merge branch 'main' into gitCommitPlugin"
},
"id": {
"abbrev": "34078b6",
"full": "34078b613c32ac9cf4f076b42232e3d9523aaeb7",
"describe": "34078b6-dirty"
},
"time": "2022-11-01T18:59:21Z",
"history": "https://github.com/alvelchev/spring-practices-demo/commit/4b36876"
},
"branch": "gitCommitPlugin",
"build": {
"time": "2022-11-01T20:53:58Z",
"version": "0.0.1"
}
},
"build": {
"artifact": "springpageable",
"name": "springpageable",
"time": "2022-11-01T20:53:56.838Z",
"version": "0.0.1",
"group": "com.springpracticesdemo"
}
}