Skip to content

Commit

Permalink
edit README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
EMEA\VEA3SF committed Jan 22, 2024
1 parent 644a62c commit f736d6b
Showing 1 changed file with 87 additions and 41 deletions.
128 changes: 87 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### Please "star" this repository if you find it useful. Thank you.

# Java Standards

![Spring](https://github.com/alvelchev/spring-practices-demo/actions/workflows/build.yml/badge.svg)
Expand All @@ -10,52 +11,97 @@
Integration with
![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)

# Spring Boot Practices Application

In this project is demonstrated main Java Spring concepts.
Model view controller architecture, using <b>mapstruct</b> for objects mapping,<b>flyway</b> for database migration,<b>
JUNIT</b> 5 configuration for test coverage,read and filter data from json file and return it like a response, basic <b>
CRUD operations</b>.Also is demonstrated how to return a <b>Pageable response</b> which is easy to filter, sorting and
etc.Created <b>Global exception handler</b> for handle exception from the codebase and custom spring validator(example
with annotation for field and class level).Demo of how to use CriteriaBuilder for data retrieving.Added configuration for
collecting application metrics via Spring Boot Actuator and configuration for Injecting Git Information Into Spring.
In the project you can find implementation of Quartz scheduler using Cron Triggers and Expressions and Spring Custom Events.

# GitHub actions pipelines integration
Added integration with GitHub actions for code analyses with sonarcloud and codecov for code coverage report
Added integration with Docker.On every push event to main branch this action generates a new docker image with the relevant image tag.

- https://www.sonarsource.com/products/sonarcloud/
- https://sonarcloud.io/project/overview?id=alvelchev_spring-pageable-response-demo
- https://github.com/codecov/example-java-maven (example how to set-up codecov badge)
- https://app.codecov.io/gh/alvelchev/spring-practices-demo

# How to start the project

- 1.Clone the repo
- 2.Start local postgre sql
- 3.Maven clean install
- 4.Open swagger url to test the endpoints: http://localhost:8099/swagger-ui/index.html
- 5.Open Spring Boot Actuator endpoint: http://localhost:8099/actuator/

# Provided examples with implementation on SpringBoot.Links for more info:

- PageAble and sorting response: https://www.baeldung.com/spring-data-jpa-pagination-sorting → (controller package)
- Flyway: https://www.baeldung.com/database-migrations-with-flyway → (resources.db.migration package)
- JUNIT5: https://www.baeldung.com/junit-5 → (tests package)
- Global exception handler in JAVA: https://www.baeldung.com/java-global-exception-handler → (advice package)
- CriteriaBuilder: https://www.baeldung.com/spring-data-criteria-queries → (repository.custom package and CriteriaBuilderExampleController)
- Custom validator: https://www.baeldung.com/spring-mvc-custom-validator → (validator package)
- Spring Boot Actuator: https://www.baeldung.com/spring-boot-actuators
- Injecting Git Information Into Spring: https://www.baeldung.com/spring-git-information → (HistoryLinkProvidingGitInfoContributor.class)
- Quartz Job Scheduler with Cron Triggers and Expressions: https://www.quartz-scheduler.org/ → (configuration.quartz package)
- Spring Custom Events: https://www.baeldung.com/spring-events → (event package)
# Spring Practices Demo

![Spring Build](https://github.com/alvelchev/spring-practices-demo/actions/workflows/build.yml/badge.svg)
[![Docker Image CI](https://github.com/alvelchev/spring-practices-demo/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/alvelchev/spring-practices-demo/actions/workflows/docker-image.yml)
[![Codecov](https://codecov.io/gh/alvelchev/spring-practices-demo/branch/main/graph/badge.svg)](https://codecov.io/gh/alvelchev/spring-practices-demo)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

### Please "star" this repository if you find it useful. Thank you.

## Table of Contents

- [Introduction](#java-standards)
- [Key Features](#key-features-and-demonstrations)
- [GitHub Actions Pipelines Integration](#github-actions-pipelines-integration)
- [How to Start the Project](#how-to-start-the-project)
- [Provided Examples with Implementation on Spring Boot](#provided-examples-with-implementation-on-spring-boot)
- [Branches](#branches)
- [Git Commit Plugin Response](#git-commit-plugin-response)

## Introduction

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.

## Key Features and Demonstrations

- **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.

## GitHub Actions Pipelines Integration

- 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.

### SonarCloud:

- [SonarCloud](https://www.sonarsource.com/products/sonarcloud/)
- [SonarCloud Project Overview](https://sonarcloud.io/project/overview?id=alvelchev_spring-pageable-response-demo)

### Codecov:

- [Codecov Example](https://github.com/codecov/example-java-maven) (example of how to set up Codecov badge)
- [Codecov Dashboard](https://app.codecov.io/gh/alvelchev/spring-practices-demo)

## How to Start the Project

1. Clone the repository.
2. Start the local PostgreSQL.
3. Run Maven clean install.
4. Open the Swagger URL to test the endpoints: [Swagger UI](http://localhost:8099/swagger-ui/index.html)
5. Open Spring Boot Actuator endpoint: [Actuator](http://localhost:8099/actuator/)

## Provided Examples with Implementation on Spring Boot

- Pageable and Sorting Response: [Baeldung Tutorial](https://www.baeldung.com/spring-data-jpa-pagination-sorting) → (
controller package)
- Flyway: [Baeldung Tutorial](https://www.baeldung.com/database-migrations-with-flyway) → (resources.db.migration
package)
- JUNIT5: [Baeldung Tutorial](https://www.baeldung.com/junit-5) → (tests package)
- Global Exception Handler in Java: [Baeldung Tutorial](https://www.baeldung.com/java-global-exception-handler) → (
advice package)
- CriteriaBuilder: [Baeldung Tutorial](https://www.baeldung.com/spring-data-criteria-queries) → (repository.custom
package and CriteriaBuilderExampleController)
- Custom Validator: [Baeldung Tutorial](https://www.baeldung.com/spring-mvc-custom-validator) → (validator package)
- Spring Boot Actuator: [Baeldung Tutorial](https://www.baeldung.com/spring-boot-actuators)
- Injecting Git Information Into Spring: [Baeldung Tutorial](https://www.baeldung.com/spring-git-information) → (
HistoryLinkProvidingGitInfoContributor.class)
- Quartz Job Scheduler with Cron Triggers and Expressions: [Quartz Scheduler](https://www.quartz-scheduler.org/) → (
configuration.quartz package)
- Spring Custom Events: [Baeldung Tutorial](https://www.baeldung.com/spring-events) → (event package)

# Branches:

- Branch with name: "java11Version" is set up for JDK11
- Main branch is with the newest spring boot 3.0.2 and JDK17

Git commit plugin response:
# Git commit plugin response:

```yaml
// 20221101225521
Expand Down

0 comments on commit f736d6b

Please sign in to comment.