Java Enterprise Template is a boilerplate project that enables developers to start enterprise-level projects quickly. It is a lightweight and modular template that utilizes the best practices and design patterns for enterprise applications. The project is built on top of Java/Kotlin and Spring Framework and provides an opinionated, easy-to-use, and scalable structure to build enterprise-level applications.
- Stack
- Project structure
- Documentation API
- How to build locally
- SonarQube
- Contributing
- Show your support
Kotlin
based onJava 17
- Build automation tool is
Gradle
Spring Framework
(Boot, Cloud, Data JPA, Web, Test, Kafka, Quartz)- Using
PostgreSQL
database with migration tool -Flyway
- Unit and integration testing with
JUnit
andMockito
Swagger UI
for API documentationDocker compose
includes:Postgres
,SonarQube
,Zookeeper
,Kafka
Libraries and plugins along with their versions are in the
file libs.versions.toml
(documentation).
The project is based on microservice architecture. Repository root directories can be divided into types:
lib-*
- libraries, starters, auto-configurations for use in microservicesms-*
- microservice module, contains 2 submodules:ms-*-api
- module that provides the REST API endpoints for the application. It contains the interface API, DTOs, and request/response modelsms-*-core
- module that contains the business logic and data access for the application. It depends on the ms-api module for the REST API endpoints.
Project provides API documentation using Swagger UI. You can access the Swagger UI by running a microservice and navigating to the following URL:
http://localhost:${MS_SERVER_PORT}/swagger-ui/index.html#/
The assembly of the main core
module mainly depends on the api
module, as well as the project's shared
modules/libraries.
- run command
./gradlew clean publishMavenPublicationToMavenLocal
- for module/from directoryms-*-api
orlib-*
- make sure the version in the
toml
file matches the version from the first point - run
Reload gradle project
oncore
module (to pull this API version from local maven)
SonarQube is a popular open-source platform that provides continuous code inspection and quality analysis for applications. It is designed to help developers improve the quality, maintainability, and reliability of their code by identifying and reporting issues such as code smells, bugs, vulnerabilities, and technical debt.
For the microservice you want to analyze, you need to specify in build.gradle.kts
:
plugins {
alias(libs.plugins.sonarqubePlugin)
}
sonarqube {
properties {
property("sonar.sourceEncoding", "UTF-8")
}
}
Command to start analysis:
`gradle sonarqube -Dsonar.login=<login> -Dsonar.host.url=<url>`
where for -Dsonar.login
we specify the token that was generated in SonarQube; for -Dsonar.host.url
we specify the
host on which SonarQube is deployed.
If you find a bug or want to contribute to the project, please feel free to create a pull request or open an issue.
Please ⭐️ this repository if this project helped you!
Copyright © 2023 Vadim Kolchanov.
Java Enterprise Template is open-source software licensed under the MIT license.