0Pricing
Spring Boot 4 Microservices & REST APIs · Pelajaran

Konfigurasi Berbasis Git

Kelola versi konfigurasi Anda dalam repositori Git.

Konfigurasi Berbasis Git adalah pelajaran Spring Boot 4 Microservices & REST APIs gratis di CoddyKit. Ini adalah pelajaran 2 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar Spring Boot 4 Microservices & REST APIs, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus Spring Boot 4 Microservices & REST APIs mencakup 4 pelajaran total.

Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.

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

Pertanyaan yang Sering Diajukan

Apakah pelajaran “Konfigurasi Berbasis Git” gratis?

Ya — teks lengkap “Konfigurasi Berbasis Git” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus Spring Boot 4 Microservices & REST APIs, upgrade ke CoddyKit PRO. Kursus Spring Boot 4 Microservices & REST APIs mencakup 4 pelajaran total.

Apa yang akan aku pelajari di “Konfigurasi Berbasis Git”?

Kelola versi konfigurasi Anda dalam repositori Git. Kamu berlatih Spring Boot 4 Microservices & REST APIs dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.

Apakah aku perlu pengalaman untuk memulai Spring Boot 4 Microservices & REST APIs?

Tidak diperlukan pengalaman sebelumnya. Spring Boot 4 Microservices & REST APIs di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 2 dari 4.

Berapa lama pelajaran “Konfigurasi Berbasis Git” memakan waktu?

Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.

Bisakah aku menulis dan menjalankan kode dalam pelajaran Spring Boot 4 Microservices & REST APIs ini?

Ya. Setiap pelajaran Spring Boot 4 Microservices & REST APIs menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.

Semua pelajaran dalam kursus ini

  1. Server Konfigurasi
  2. Konfigurasi Berbasis Git
  3. Klien Konfigurasi
  4. Menyegarkan Konfigurasi saat Runtime
← Kembali ke Spring Boot 4 Microservices & REST APIs