0Pricing
Spring Boot 4 Microservices & REST APIs · Lesson

Git-Backed Configuration

Version your config in a Git repository.

Git-Backed Configuration is a free Spring Boot 4 Microservices & REST APIs lesson on CoddyKit — lesson 2 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.

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.yml

Shared 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-2026

Search 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: true

Picking 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-config

Keeping 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.yml overrides
  • Configure URI, label (branch), search-paths and credentials
  • Keep secrets encrypted, never plaintext

Frequently asked questions

Is the “Git-Backed Configuration” lesson free?

Yes — the full text of “Git-Backed Configuration” 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 “Git-Backed Configuration”?

Version your config in a Git repository. 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 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Git-Backed Configuration” 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