Skip to main content

SureInk Common Library (sureink-common)

Type: Library (not a runnable microservice)

Overview

The sureink-common module is a shared Java library that provides a wide range of common utilities, base classes, configurations, and helper functions for the SureInk Platform. Its primary purpose is to promote code reuse, ensure consistency, and reduce boilerplate code across the various microservices in the platform.

This library is a dependency for most, if not all, other Java-based microservices within the SureInk ecosystem.

Key Features & Provided Components

Based on its dependencies and package structure, sureink-common likely provides:

  • Client Utilities (client/):
    • Common configurations for Spring Cloud OpenFeign clients (e.g., request/response logging interceptors, error decoders, authentication header propagation).
    • Potentially, abstract base classes or factories for creating Feign clients.
  • Data Transfer Objects (dto/):
    • A collection of common Data Transfer Objects (DTOs) used for internal communication or for more generic use cases not covered by sureink-common-model.
  • Persistence Utilities (persistence/):
    • Base JPA entity classes (e.g., an abstract AuditedEntity that includes common fields like createdAt, updatedAt, and integrates with Hibernate Envers for auditing).
    • Common JPA repository interfaces or utility functions.
  • Microservice Infrastructure (microservice/):
    • Shared Spring Boot configurations relevant to all microservices (e.g., common exception handlers, security filter beans, Actuator endpoint configurations).
    • Base classes for Spring components like services or controllers.
  • Event Handling Utilities (event/):
    • Base classes or common interfaces for Kafka event producers and consumers.
  • Reporting Utilities (report/):
    • Helper classes for generating reports in formats like CSV (using commons-csv) and Microsoft Excel (using apache-poi).
  • General Utilities (util/):
    • A collection of miscellaneous helper functions, such as:
      • String manipulation utilities.
      • Date and time processing utilities (leveraging jackson-datatype-jsr310 for proper JSR-310 serialization).
      • Validation helpers (using jakarta.validation-api).
  • Shared Security Configurations:
    • Common Keycloak adapter configurations or utilities for simplifying security setup in microservices.

Dependencies

This library bundles several common dependencies that are then transitively available to services that include sureink-common. Key among them are:

  • Spring Boot starters (core, data-jpa, security)
  • Spring Cloud OpenFeign
  • Keycloak Spring Boot Starter
  • Hibernate Envers
  • Jackson Datatypes (JSR310)
  • Apache Commons CSV
  • Apache POI
  • Lombok
  • sureink-common-model (for shared domain models)

Usage

To use this library, other Maven-based microservices in the SureInk Platform should include it as a dependency in their pom.xml:

<dependency>
<groupId>com.sureink</groupId>
<artifactId>sureink-common</artifactId>
<version>1.0-SNAPSHOT</version> <!-- Or the relevant version -->
</dependency>

Building

As a library, sureink-common is built as part of the overall SureInk Platform build process:

# From the root project directory
mvn clean install

This will compile its code and install the resulting JAR into the local Maven repository, making it available to other modules.