Project Description
- Getting Started
- Technologies
- Project Structure
- Authentication and Authorization
- API First
- Domain Modeling and Code Generation with ZenWave SDK
- Testing
- Code Formatting
After cloning the project, you can start the project with the following command:
docker-compose up -d
mvn spring-boot:run -Dspring-boot.run.profiles=local- Java 21+
- Maven 3.6+
- Docker/Docker Compose
- Git and Git-Bash
- JBang and ZenWave SDK (optional)
- SDKMAN! (optional but highly recommended)
- Spring Boot 3.3.x
- Spring Data JPA or MongoDB
- Spring Data Elasticsearch
- Spring Cloud Streams for Kafka, RabbitMQ, or other Message Brokers
- Spring Security
- KarateDSL for API Testing
- ZenWave SDK for Domain Modeling and Code Generation (optional)
The project uses openapi-generator-maven-plugin (see pom.xml) to generate SpringMVC interfaces and DTOs from the src/main/resources/public/apis/openapi.yml file.
Generated sources are placed in target/generated-sources/openapi which becomes a source folder for the project. To implement the API, you can create a new @RestController and implement the generated interface.
You can customize generated code with this properties in pom.xml or directly in the plugin openapi-generator-maven-plugin:
<openApiApiPackage>${basePackage}.adapters.web</openApiApiPackage>
<openApiModelPackage>${basePackage}.adapters.web.model</openApiModelPackage>SwaggerUI is available at http://localhost:8080/swagger-ui/index.html. If you need to add more OpenAPI files, you can customize SwaggerUI in application.yml:
springdoc.swagger-ui.urls:
- name: Project Name
url: /apis/openapi.ymlURL is relative to 'src/main/resources/public'.
This project also uses zenwave-sdk-maven-plugin to generate interfaces, DTOs and producers/consumers using Spring Cloud Streams from the src/main/resources/public/apis/asyncapi.yml file.
If this file does not exist, code generation is skipped. Generated sources are placed in target/generated-sources/zenwave which becomes a source folder for the project.
You can customize generated code with this properties in pom.xml or directly in the plugin zenwave-sdk-maven-plugin:
<asyncApiModelPackage>${basePackage}.events.dtos</asyncApiModelPackage>
<asyncApiProducerApiPackage>${basePackage}.events.producer</asyncApiProducerApiPackage>
<asyncApiConsumerApiPackage>${basePackage}.events.consumer</asyncApiConsumerApiPackage>See https://www.zenwave360.io/zenwave-sdk/plugins/asyncapi-spring-cloud-streams3/ for more information about API-First with AsyncAPI and ZenWave SDK.
ZenWave SDK allows you to focus on Domain Modeling and Analysis using a Domain Specific Language (ZenWave Domain Language or ZDL) to define your domain model.
Then you can use ZenWave SDK command line or IntelliJ IDEA plugin to generate code from your analysed domain model.
Use JBang to install a self-updating evergreen version of ZenWave SDK Command Line.
jbang alias add --fresh --force --name=zw release@zenwave360/zenwave-sdkThis will give you access to the jbang zw command line tool. You can use jbang zw --help to see all available commands.
jbang zw --help listInstall ZenWave Domain Editor for IntelliJ IDEA from the marketplace.
See https://www.zenwave360.io/docs/getting-started/ for more information about ZenWave SDK.
The base project comes with to files:
zenwave-scripts.zdl: sample scripts you can use from IntelliJ to run ZenWave commands and generate different software artifacts.zenwave-model.zdl: sample model you can use to generate a sample application and use it as a reference for your own modeling and analysis.
This project is configured to use Spotless with Palantir Java Format as code formatter. You can apply code formatting from the command line with the following command:
mvn spotless:applyYou can also configure your IDE for code automatic code formating with the following plugins:
- https://plugins.jetbrains.com/plugin/13180-palantir-java-format
- https://github.com/palantir/palantir-java-format/tree/develop/eclipse_plugin
Keep a consistent code style from the beginning of the project.
The plugin will be disabled by default on new projects. To manually enable it in the current project, go to File→Settings...→palantir-java-format Settings (or IntelliJ IDEA→Preferences...→Other Settings→palantir-java-format Settings on macOS) and check the Enable palantir-java-format checkbox.
To enable it by default in new projects, use File→Other Settings→Default Settings....
When enabled, it will replace the normal Reformat Code action, which can be triggered from the Code menu or with the Ctrl-Alt-L (by default) keyboard shortcut.
Happy Coding!! 🚀🚀🚀