Backend Development 22 min read

Apollo Configuration Center: Concepts, Architecture, and Spring Boot Integration Guide

This article provides a comprehensive tutorial on Apollo, covering its basic concepts, architecture, four-dimensional configuration model, client design, high‑availability considerations, and step‑by‑step instructions for creating a Spring Boot project, integrating Apollo dependencies, configuring environments, testing dynamic updates, and deploying the application on Kubernetes.

Architect's Guide
Architect's Guide
Architect's Guide
Apollo Configuration Center: Concepts, Architecture, and Spring Boot Integration Guide

Apollo (Apollo Configuration Center) is an open‑source configuration management platform developed by Ctrip that centralizes configuration for applications across environments, clusters, and namespaces, offering real‑time updates, permission control, and audit mechanisms.

Basic Concepts

The platform introduces four dimensions—application, environment, cluster, and namespace—to organize key‑value configurations. Environments include DEV, FAT, UAT, and PRO; clusters group instances (e.g., by data center); namespaces separate configuration files such as database or RPC settings.

Core Model

When a user modifies and publishes a configuration, the Config Service notifies Apollo clients, which pull the latest values, update local caches, and inform the application.

Local Cache

Clients cache configuration files under /opt/data/{appId}/config-cache (Linux/macOS) or C:\opt\data\{appId}\config-cache (Windows). The cache file naming pattern is {appId}+{cluster}+{namespace}.properties .

Client Design

Clients maintain a long‑polling HTTP connection with the server for push updates and periodically poll for changes. If no change occurs within 60 seconds, the server returns HTTP 304, and the client reconnects.

High Availability

Both Config Service and Admin Service are stateless and can be scaled horizontally; service discovery is handled via Eureka and a Meta Server layer.

Step‑by‑Step Integration

1. Create a project in Apollo Portal (e.g., appId apollo-test , appName apollo-demo ) and add a configuration key test with value 123456 .

2. Build a Spring Boot project and add Maven dependencies for spring-boot-starter-web and apollo-client (version 1.4.0).

3. In application.yml , configure Apollo parameters such as apollo.meta , apollo.cluster , apollo.bootstrap.enabled , and namespaces.

4. Create a controller that injects the test value using @Value("${test:默认值}") and exposes it via /test .

5. Add JVM arguments -Dapollo.configService=http:// :30002 -Denv=DEV (or adjust for PRO, clusters, namespaces) to enable dynamic configuration.

6. Test the application: the endpoint returns the value from Apollo, updates after publishing changes, falls back to cached values when the server is unreachable, and reverts to the default when the key is deleted.

Exploring Clusters and Namespaces

By setting apollo.cluster to beijing or shanghai , or specifying different namespaces (e.g., dev-1 , dev-2 ), the same application can retrieve distinct configuration values for different deployment scenarios.

Kubernetes Deployment

Build a Docker image with a Dockerfile that defines JAVA_OPTS and APP_OPTS environment variables. Deploy the image using a Kubernetes manifest ( springboot-apollo.yaml ) that sets JAVA_OPTS="-Denv=DEV" and provides Apollo parameters via APP_OPTS . Expose the service with a NodePort and verify the /test endpoint returns the expected configuration value.

The tutorial demonstrates how Apollo enables centralized, real‑time configuration management for Java microservices and how to integrate, test, and deploy such services in a cloud‑native environment.

JavamicroservicesKubernetesconfiguration-managementSpringBootApollo
Architect's Guide
Written by

Architect's Guide

Dedicated to sharing programmer-architect skills—Java backend, system, microservice, and distributed architectures—to help you become a senior architect.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.