---
title: "(NEW) Centralized configuration as a Spring Cloud Config provider"
canonical: "https://onesaitplatform.refined.site/space/DOCT/3842768897/(NEW)%20Centralized%20configuration%20as%20a%20Spring%20Cloud%20Config%20provider"
format: markdown
---
> Macro (toc)

> ℹ️ Available since Release 5.1.0 (Survivor)

# Goal

The objective of this functionality is to be able to use the [Centralized Platform Configuration](https://onesaitplatform.atlassian.net/wiki/spaces/DOCT/pages/2221606170/How+to+use+Central+Configuration+util+on+your+application) 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](https://docs.spring.io/spring-cloud-config/docs/current/reference/html/)  as a [Centralized Platform Configuration](https://onesaitplatform.atlassian.net/wiki/spaces/DOCT/pages/2221606170/How+to+use+Central+Configuration+util+on+your+application).

This is done by using the Spring configuration for [Custom Composite Environment Repositories](https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#_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.

```xml
<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:

```xml
<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*.

```yaml
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.