0Pricing
Spring Boot 4 Microservices & REST APIs · Aula

Configuração respaldada pelo Git

Versione sua configuração em um repositório Git.

Configuração respaldada pelo Git é uma aula grátis de Spring Boot 4 Microservices & REST APIs no CoddyKit. Esta é a aula 2 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Spring Boot 4 Microservices & REST APIs, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Spring Boot 4 Microservices & REST APIs inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

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

Perguntas Frequentes

A aula “Configuração respaldada pelo Git” é grátis?

Sim — o texto completo de “Configuração respaldada pelo Git” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Spring Boot 4 Microservices & REST APIs, atualize para CoddyKit PRO. O curso de Spring Boot 4 Microservices & REST APIs inclui 4 aulas no total.

O que vou aprender em “Configuração respaldada pelo Git”?

Versione sua configuração em um repositório Git. Você pratica Spring Boot 4 Microservices & REST APIs com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Spring Boot 4 Microservices & REST APIs?

Nenhuma experiência prévia é necessária. Spring Boot 4 Microservices & REST APIs no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 2 de 4.

Quanto tempo leva a aula “Configuração respaldada pelo Git”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Spring Boot 4 Microservices & REST APIs?

Sim. Cada aula de Spring Boot 4 Microservices & REST APIs inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. O servidor de configuração
  2. Configuração respaldada pelo Git
  3. Clientes de configuração
  4. Atualizando a configuração em tempo de execução
← Voltar para Spring Boot 4 Microservices & REST APIs