The Dept44
framework provides a comprehensive structure and shared configurations for various Spring Boot
microservices used by Sundsvalls kommun.
This project includes modules for common functionality, shared dependencies, and standards that simplify the creation and management of consistent, high-quality services. Key areas covered include:
- Dependency Management: Shared dependencies and versioning for consistency across services.
- Code Formatting: Enforced through the
dept44-formatting-plugin
, which provides a standardized code style. - Build Tools: Utilities and plugins configured for streamlined builds and deployments.
The Dept44 parent project organizes a suite of purpose-built modules, each crafted to streamline and standardize Spring Boot microservices. These modules encapsulate reusable components, configurations, and tools to simplify development across projects. Here’s an overview:
dept44-models
: Contains shared data models used across services, promoting consistency and reuse of core domain objects.dept44-build-tools
: Provides essential build utilities and checks, including tools for verifying OpenAPI properties and truststore configurations.dept44-service-parent
: A common parent for service modules, encapsulating shared configurations and dependencies for microservices.dept44-starter-parent
: Base parent module for starter configurations, allowing rapid service bootstrapping.dept44-starter
: Core Spring Boot starter module that includes essential configurations and dependencies.dept44-starter-authorization
: Adds authorization handling utilities and pre-configured security settings.dept44-starter-feign
: Pre-configured Feign client starter, simplifying service-to-service communication.dept44-starter-logback-logserver
: Logback configuration for structured logging, optimized for centralized log management.dept44-starter-test
: Testing utilities and configurations to streamline unit and integration testing.dept44-starter-webclient
: Simplifies HTTP client setup using Spring’s WebClient, enhancing service communication.dept44-starter-webservicetemplate
: Streamlined configuration for SOAP-based services using WebServiceTemplate.dept44-common-validators
: Provides a set of common validators for data integrity and validation within services.dept44-example
: An example microservice using the Dept44 parent configurations as a reference implementation.dept44-formatting-plugin
: Maven plugin for consistent code formattingdept44-starter-scheduler
: Streamlines scheduled task management with robust exception handling, automated health checks, and ShedLock integration.
For more details, see each module’s README or documentation in the repository.
To keep our codebase clean and consistent, we use a custom Maven plugin, dept44-formatting-plugin
, instead of directly
configuring Spotless. This plugin ensures uniform formatting across Java, SQL, JSON, Markdown, and pom.xml
files.
Our plugin provides two primary commands:
-
Check formatting:
Usemvn dept44-formatting:check
to validate that code follows the project’s formatting rules. -
Apply formatting:
Usemvn dept44-formatting:apply
to automatically apply the required formatting.
The dept44:formatting-check
goal is also configured to run during the Maven validation phase, ensuring all code meets
formatting standards before builds proceed.
For more details, refer to
the plugin documentation here.
Note for dept44
: Because dept44-formatting-plugin
is a module of the parent in this project, you need to run the
commands manually for the plugin to take effect on the parent pom.
Contributions are welcome! See the CONTRIBUTING.md for guidelines.
This plugin is distributed under the MIT License.
© 2024 Sundsvalls kommun