Git-gestützte Konfiguration
Versionieren Sie Ihre Konfiguration in einem Git-Repository.
Git-gestützte Konfiguration ist eine kostenlose Spring Boot 4 Microservices & REST APIs-Lektion auf CoddyKit. Dies ist Lektion 2 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.
Why Git as the backend
Storing configuration in Git gives you version history, code review, and rollback. The Config Server simply reads files from a configured repository.
The config repo layout
Each service has one or more YAML/properties files named after its application name, optionally with a profile suffix.
// config-repo/
// application.yml (shared by all)
// orders.yml (orders, default profile)
// orders-prod.yml (orders, prod profile)
// inventory.ymlShared application.yml
A file literally named application.yml holds defaults applied to every client. Put cross-cutting settings (logging, common URLs) here.
Profile-specific overrides
Profile files like orders-prod.yml override the base orders.yml for that profile. The server merges them, with the profile file taking precedence.
Pointing the server at the repo
Set the Git URI on the server. For private repos add credentials or an SSH key.
spring:
cloud:
config:
server:
git:
uri: https://github.com/acme/config-repo
username: ci-bot
password: ${GIT_TOKEN}Choosing a branch (label)
The Git label defaults to main/master but can be any branch or tag. Clients can request a specific label, enabling per-environment branches.
server:
cloud:
config:
server:
git:
default-label: release-2026Search paths in the repo
If config lives in subfolders, set search-paths so the server looks in the right places. Placeholders like {application} are supported.
spring:
cloud:
config:
server:
git:
uri: https://github.com/acme/config-repo
search-paths: "{application}"Cloning behavior
The server clones the repo on first request (or eagerly). With clone-on-start: true it fails fast at boot if the repo is unreachable, surfacing misconfiguration early.
spring:
cloud:
config:
server:
git:
clone-on-start: truePicking up new commits
On each client request the server checks for new commits. So pushing a change to the repo makes it available - clients still need to be refreshed to apply it (covered later).
Multiple repos
You can map different applications or patterns to different repositories, e.g. keep secrets in a separate, tightly-controlled repo.
spring:
cloud:
config:
server:
git:
uri: https://github.com/acme/general-config
repos:
secure:
pattern: payments-*
uri: https://github.com/acme/secure-configKeeping secrets safe
Even in Git, never commit plaintext secrets. Use the server's {cipher} encryption or an external secret manager, and restrict repo access.
Quick Check
Verify your Git-backend understanding.
Recap
You backed config with Git:
- Files named by application + optional profile suffix
application.yml= shared defaults;app-profile.ymloverrides- Configure URI, label (branch), search-paths and credentials
- Keep secrets encrypted, never plaintext
Häufig gestellte Fragen
Ist die Lektion „Git-gestützte Konfiguration“ kostenlos?
Ja — der vollständige Text von „Git-gestützte Konfiguration“ 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 „Git-gestützte Konfiguration“?
Versionieren Sie Ihre Konfiguration in einem Git-Repository. 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 2 von 4.
Wie lange dauert die Lektion „Git-gestützte Konfiguration“?
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
- Der Config Server
- Git-gestützte Konfiguration
- Config Clients
- Konfiguration zur Laufzeit aktualisieren