0Pricing
Spring Boot 4 Microservices & REST APIs · Lesson

The Config Server

Serve configuration from a central server.

The Config Server is a free Spring Boot 4 Microservices & REST APIs lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Spring Boot 4 Microservices & REST APIs learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The configuration problem

In a microservices system, many services each need configuration. Duplicating application.yml everywhere is error-prone. Spring Cloud Config centralizes configuration in one server.

What the Config Server does

The Config Server is a small Spring Boot app that serves configuration to client services over HTTP, typically backed by a Git repository.

  • One place to view and change config
  • Versioned, auditable changes

Adding the server dependency

Create a new app and add spring-cloud-config-server.

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-config-server</artifactId>
</dependency>

@EnableConfigServer

Annotate the main class with @EnableConfigServer to turn the app into a Config Server.

@SpringBootApplication
@EnableConfigServer
public class ConfigServerApp {
    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApp.class, args);
    }
}

Pointing at a backend

The server needs a backend to read config from. The most common is a Git repo, set with spring.cloud.config.server.git.uri.

# application.yml of the server
spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/acme/config-repo

Running on a known port

Config Servers conventionally run on port 8888 so clients can find them with default settings.

server:
  port: 8888

How config is addressed

The server resolves config by application name and profile. A client named orders with profile prod maps to files like orders-prod.yml in the repo.

The server HTTP API

You can query the server directly. The path is /{application}/{profile} and it returns the merged properties as JSON.

// GET http://localhost:8888/orders/prod
// returns merged config for app=orders, profile=prod

Native (filesystem) backend

For local development you can use a filesystem backend instead of Git via the native profile - convenient but not versioned.

spring:
  profiles:
    active: native
  cloud:
    config:
      server:
        native:
          search-locations: file:./config

Securing the server

Config can contain secrets, so protect the server with HTTP Basic auth (Spring Security) and run it behind your private network. Clients then send credentials.

Encryption support

The server can store encrypted values (prefixed {cipher}) and decrypt them on the fly, so secrets are never stored in plaintext in the repo - provided a key is configured.

Quick Check

Check your Config Server fundamentals.

Recap

You stood up a Config Server:

  • It centralizes config and serves it over HTTP
  • @EnableConfigServer + a Git (or native) backend
  • Runs on port 8888 by convention
  • Resolves config by application name and profile

Frequently asked questions

Is the “The Config Server” lesson free?

Yes — the full text of “The Config Server” is free to read here on the web, and the Spring Boot 4 Microservices & REST APIs course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Spring Boot 4 Microservices & REST APIs course, upgrade to CoddyKit PRO.

What will I learn in “The Config Server”?

Serve configuration from a central server. You practise Spring Boot 4 Microservices & REST APIs with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Spring Boot 4 Microservices & REST APIs?

No prior experience is required. Spring Boot 4 Microservices & REST APIs on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “The Config Server” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Spring Boot 4 Microservices & REST APIs lesson?

Yes. Every Spring Boot 4 Microservices & REST APIs lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. The Config Server
  2. Git-Backed Configuration
  3. Config Clients
  4. Refreshing Configuration at Runtime
← Back to Spring Boot 4 Microservices & REST APIs