0Pricing
Spring Boot 4 Microservices & REST APIs · Lektion

Der Config Server

Stellen Sie Konfiguration von einem zentralen Server bereit.

Der Config Server ist eine kostenlose Spring Boot 4 Microservices & REST APIs-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Spring Boot 4 Microservices & REST APIs-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Spring Boot 4 Microservices & REST APIs-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

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

Häufig gestellte Fragen

Ist die Lektion „Der Config Server“ kostenlos?

Ja — der vollständige Text von „Der Config Server“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Spring Boot 4 Microservices & REST APIs-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Spring Boot 4 Microservices & REST APIs-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Der Config Server“?

Stellen Sie Konfiguration von einem zentralen Server bereit. Du übst Spring Boot 4 Microservices & REST APIs mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Spring Boot 4 Microservices & REST APIs zu starten?

Keine Vorkenntnisse erforderlich. Spring Boot 4 Microservices & REST APIs auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.

Wie lange dauert die Lektion „Der Config Server“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Spring Boot 4 Microservices & REST APIs-Lektion Code schreiben und ausführen?

Ja. Jede Spring Boot 4 Microservices & REST APIs-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Der Config Server
  2. Git-gestützte Konfiguration
  3. Config Clients
  4. Konfiguration zur Laufzeit aktualisieren
← Zurück zu Spring Boot 4 Microservices & REST APIs