Back & Architecture

Initializr Usage Guide

An Initializr is an API that allows you to create a project with its dependencies quickly and easily. In the case of Onesait, we have an Initializr whose main function is to provide an initialization archetype to the user in order to speed up the creation of a Microservice with Onesait structure and standards, and including Maven and Spring.

The tool allows you to create a new blank project, or alternatively to add a number of modules and libraries in an automated way thanks to the choice of those from the selectable boxes. The new utilities will be added to the project through the automatic inclusion of dependencies in the pom.xml of the new application and the inclusion of the configuration classes of each functionality if needed.

If you want to test the tool and have access permissions, you can download the Initializr CLI from our GitLab.


For the development of the project, the following technologies are used:

  • Maven: For dependency resolution.
  • Java: For the implementation of the application module.
  • Lombok: To simplify the use of class methods.
  • Jenkins: Configuration files for the connection to the architecture pipeline. For more information, see the Jenkins configuration instructions section.
  • Swagger Codegen: used for code generation.

Available modules and libraries

Next we show a list with all the modules and libraries that can be imported into the new project. The versions of the libraries are provided by the «architecture-dependencies», which provides the most current versions of the most used dependencies.

Libraries included and generated by the Initializr

LibraryDescriptionVersion included
Library that adds the versions of the most used Spring and architecture libraries.0.0.1-SNAPSHOT
audit-libLibrary that allows auditing the operations of our service to store these records and that can be exploited later.0.0.4-SNAPSHOT
Library to facilitate the exchange of value between different currencies.0.0.3-SNAPSHOT
Library to facilitate the use and conversion between different time slots.0.0.3-SNAPSHOT
architecture-utilsDependency that encompasses a number of functionalities that may be useful throughout the development of microservices.1.0.5-SNAPSHOT
drools-platformService to make use of business rules hosted in OP.1.0.2.RELEASE
hazelcast-platformService to speed up the use of HazelCast and abstract us from the configuration, all of them in the OP.1.0.5.RELEASE
logback-fluentdDependencies and configuration to send logs to Fluentd.
Java library prepared to run on Spring Boot and that simplifies access to the Onesait Platform’s DigitalBroker.2.0.2-RELEASE
Security dependency delegated to the OP.1.5.0-RELEASE
spring-boot-admin-starter-clientDependency for monitoring through Spring Boot Admin.2.3.0
Dependency and configuration for a client that picks up its configuration from a Spring Cloud Config server.2.2.5.RELEASE
Dependency and configuration for a client that collects its configuration from Kubernetes configuration files.1.1.6.RELEASE
spring-data-jpaPlatform notification dependency using Spring Data JPA.
spring-data-mongoPlatform notification dependency using Spring Data Mongo.
user-administratorLibrary to facilitate the use and abstraction of the OP’s user management.1.2.4.RELEASE

Modules included and generated by the Initializr

ModuleDescriptionVersion included
Jenkins pipeline to perform periodic tests on an API.
Monitoring microservices using Spring Boot Admin0.0.1-SNAPSHOT
login-backendLogin module by oauth2 against the OP, includes the library user-administrator.1.0.0-RELEASE
Example of usage and configuration of Spring Batch.
spring-cloud-configServer-function module in charge of collecting configurations from a data source and serving them to client projects.0.0.1-SNAPSHOT
Module to facilitate the use and abstraction of the user management of the OP.1.2.4.RELEASE

Structure of the generated project

Next, we are going to detail the structure generated by an execution of a cycle of operations such as «init». If we observe the execution, we see that, under the specified path, the project with the name of «onesait-<artifactId>» has been generated. Under this directory, the following structure will be generated:

  • Directory «/sources»:
    • pom.xml: Spring Boot dependencies, Spring Security, Onesait Platform repositories, Maven plugin package, Onesait utility library, etc.
    • podTemplate.yaml
    • settings.xml
    • JenkinsFile
    • /docker: Basic Dockerfile for the application.
    • /src/main/java/com/minsait/onesait/<artifactId>:
      • /configuration: adds the OpenApi and Spring Security configuration classes.
      • /controllers: contains a sample REST controller. If the API description YAML file is specified, the corresponding classes will be created.
      • /model: contains some example models. If the API description YAML file is specified, the corresponding classes will be created.
      • /service: contains the services and their example implementations.


YAML file

Additionally, when creating a microservice using the Initializr, a YAML file describing the project’s APIs can be attached. With this, the Initializr, apart from generating the base microservice with the dependencies that we have configured for it, will generate the controllers and models for said documentation.

Adicionalmente a la hora de crear un microservicio haciendo uso del Initializr, se puede adjuntar un fichero YAML de descripción de las APIs del proyecto. Con esto, el Initializr aparte de generarnos el microservicio base con las dependencias que le hayamos configurado, nos generará los controladores y modelos para dicha documentación.

Jenkins configuration instructions

The generated projects contain a default configuration to use the Jenkins pipeline linked to a Git repository. To do this, a JenkinsFile and a PodTemplate.yaml file are provided, which must be modified to point to the repository in question. Also included is a settings.xml file that provides access to the Nexus architecture by default.

In addition to modifying these files, you must request to the DevOps team the creation of the pipeline, which hangs from the corresponding seed.

Header image: modified from Luke Thornton at Unsplash

✍🏻 Author(s)

Leave a Reply

Your email address will not be published. Required fields are marked *