El Config Server
Sirva la configuración desde un servidor central
El Config Server es una lección gratuita de Spring Boot 4 Microservices & REST APIs en CoddyKit. Esta es la lección 1 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Spring Boot 4 Microservices & REST APIs, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Spring Boot 4 Microservices & REST APIs incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
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-repoRunning on a known port
Config Servers conventionally run on port 8888 so clients can find them with default settings.
server:
port: 8888How 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=prodNative (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:./configSecuring 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
Preguntas frecuentes
¿La lección «El Config Server» es gratis?
Sí — el texto completo de «El Config Server» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Spring Boot 4 Microservices & REST APIs, actualiza a CoddyKit PRO. El curso de Spring Boot 4 Microservices & REST APIs incluye 4 lecciones en total.
¿Qué aprenderé en «El Config Server»?
Sirva la configuración desde un servidor central Practicas Spring Boot 4 Microservices & REST APIs con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar Spring Boot 4 Microservices & REST APIs?
No se requiere experiencia previa. Spring Boot 4 Microservices & REST APIs en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 1 de 4.
¿Cuánto tiempo toma la lección «El Config Server»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de Spring Boot 4 Microservices & REST APIs?
Sí. Cada lección de Spring Boot 4 Microservices & REST APIs incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- El Config Server
- Configuración respaldada por Git
- Clientes de configuración
- Actualizar la configuración en tiempo de ejecución