Template project for creating a new Spotinst Java service.
This project intended to be used when in need to create a new Java service.
It encapsulate the following Spotinst internal libraries:
spotinst-commons- Spotinst common utilitiesspotinst-dropwizard- Dropwizard bootstrap frameworkspotinst-messaging- Spotinst SQS messaging
- Java 21
- Git clone
- Rename package to
com.spotinst.<service-name> - Rename all
SampleXXXclasses to proper service name - Remove irrelevant content
- In
settings.gradlechange therootProject.namename - Rename IntelliJ module to proper service name
- Git push
- In
src/main/resources/banner.txtchange the content according to your service-name, usingText to ASCII Art Generator
The template contains optional content such as customer facing service filters, rate limit filters/tasks etc..
When not in need, these classes should get removed from the project.
Service configuration YAML files contains coverage of all possible components exists on the java-service-template.
Make sure to remove unnecessary configuration and un-comment the ones that in need for the new service.
What's included in the service configuration?
- Credentials/Tokens
- Services URLs
- HTTP Client
- Rate Limiter
- Feature Flags
- Dropwizard Web Server
- Messaging Producer/Consumer
- Logging
Repositories should be created under package com.spotinst.<service>.bl.repos and registered to xxxRepoManager.
Every repository class name should comply to the IxxxRepo format and it's property name should be the name of the entity it represents:
public class SampleRepoManager extends BaseRepoManager {
public static IOrganizationRepo Organization;
...
}There are two alternatives when creating a new repository:
- Create a standard repository with full implementation
- Optional:
GenericRepofor basic CRUD based entities
Model conversion can be used by two different approaches:
- Orika mapper is available on the template project for mapping Java models with partial update support
- Manual conversion methods
Make sure to follow coding guidelines by encapsulating entity mappings behaviour API <--> BL <--> DAL inside a single converter class.
