(NEW) Centralized configuration as a Spring Cloud Config provider

Available since Release 5.1.0 (Survivor)

Goal

The objective of this functionality is to be able to use the Centralized Platform Configuration as a Spring Cloud Config provider, which simplifies its use in Spring Cloud applications.

Introduction

In Q2 of 2023, a new Platform library has been created that allows the integration of Spring Cloud Config as a Centralized Platform Configuration.

This is done by using the Spring configuration for Custom Composite Environment Repositories, which allows you to use your own SpringBoot bean to load the configuration.

In addition, centralized configuration management that was previously managed in the Java client, has been integrated into this library.

How to use the config-client library in your application?

Firstly, you will have to add the following dependency to the pom.xml of the project that will act as Config Server.

<dependency> <groupId>com.minsait.onesait.platform</groupId> <artifactId>onesaitplatform-spring-config-client</artifactId> <version>5.0.0</version> </dependency>

And you will have to add the Platform repository to the list of repositories in the pom:

<repositories> <repository> <id>onesait platform releases</id> <url>https://nexus.onesaitplatform.com/nexus/content/repositories/releases/</url> </repository> </repositories>

Once the dependency is added, you will have to add the following properties to your application.yml.

spring: profiles: active: native cloud: config: server: native: search-locations: classpath:/configuration order: 1 onesaitplatform: api.rest: token: <ONESAITPLATFORM_API_KEY> endpoint: <ONESAITPLATFORM_BASE_URL> spring.cloud.config: enabled: true identification: <ONESAITPLATFORM_CONFIG>

Where:

  • ONESAITPLATFORM_API_KEY is the API Key of a user with the Platform administrator role. This key will be used to manage security at the Platform level in order to obtain centralized configuration.

  • ONESAITPLATFORM_BASE_URL is the endpoint of the Platform control panel where the centralized configuration that you want to use is located.

  • ONESAITPLATFORM_CONFIG is the name of the centralized configuration that you want to use.

Once your project is configured, when you start it, it will access the Platform and get the properties loaded in the specified centralized configuration.

Â