Skip to content

ADR 0004: Configuration Visibility Actuator Endpoint

Author: AirCommerce Architecture Team • Scope: util-configuration

In ADR 0003: Graceful Default Value Fallbacks, we implemented graceful fallback mechanisms that return application fields to their hardcoded default values when configurations are missing or deleted from the remote Configuration Service. While this greatly improved application resilience and prevented start-up crashes, it inadvertently created an observability blind spot. When a configuration was missing remotely, operations teams had no way to easily identify whether the application was running on its default values or if there was a synchronization issue, leading to potential “split-brain” debugging scenarios between the remote UI and the local application state. We needed a way to bridge this gap without breaking the fail-safe architecture.

  • Observability: Operations teams need clear, immediate visibility into what configurations the application is actively using.
  • Developer Experience (DX): Finding configuration inconsistencies should not require digging through code or attaching a debugger.
  • Security & Encapsulation: Exposing internal state must be done safely without cluttering business APIs.
  • Backwards Compatibility: The util-configuration library is shared across many services; any added visibility features must not forcibly alter the host application’s dependencies (e.g., forcing them to include Actuator if they don’t want to).
  • Option 1: Log all effective configurations on startup
  • Option 2: Expose a standard Spring @RestController endpoint
  • Option 3 (Chosen): Expose a custom Spring Boot Actuator Endpoint (@Endpoint) with @ConditionalOnClass

We chose Option 3, because it natively aligns with industry standards for application operability while protecting the encapsulation of host microservices.

By leveraging Spring Boot Actuator (@Endpoint(id = "aircommerceConfig")), we ensure that configuration visibility integrates directly into the host application’s existing management port and security configurations. The endpoint queries the ConfigurationFieldRegistry and ConfigurationNamespaceLoader to identify the live, injected value of all fields, explicitly tagging them as either REMOTE or FALLBACK_DEFAULT.

Graceful Degradation via Conditional Logic

Section titled “Graceful Degradation via Conditional Logic”

To ensure that util-configuration remains a lightweight and un-intrusive library, spring-boot-starter-actuator is included only as an <optional>true</optional> dependency. The endpoint itself is annotated with @ConditionalOnClass(Endpoint.class), meaning that if a host microservice does not use Actuator, the endpoint is completely ignored during component scanning, preventing ClassNotFoundException errors.

The actuator endpoint returns an explicit status field for every tracked configuration to instantly alert operations to its origin:

  • REMOTE: Mapped when the configuration key exists in the remote payload fetched by the ConfigurationNamespaceLoader. This indicates the application successfully retrieved and injected the configuration from the centralized server.
  • FALLBACK_DEFAULT: Mapped when the configuration key is absent from the remote payload. This indicates the application could not find the key remotely (either it was deleted or never created) and has gracefully fallen back to the local, hardcoded default value stored in the source code.
  • GARBAGE_COLLECTED: Mapped when the underlying Java bean that held the configuration field has been destroyed or garbage-collected by the JVM (tracked via WeakReference). This is an edge-case indicating the configuration field is no longer actively in use in memory.
{
"totalTrackedFields": 1,
"configurations": [
{
"namespace": "payment-service",
"key": "feature.paypal.enabled",
"status": "FALLBACK_DEFAULT",
"remoteType": null,
"declaringClass": "one.aircommerce.payment.config.PaymentConfig",
"fieldName": "paypalEnabled",
"fieldType": "Boolean",
"defaultValue": false,
"currentValue": false,
"lastUpdated": "2026-09-11T12:00:00Z"
}
]
}

Option 1: Log all effective configurations on startup

Section titled “Option 1: Log all effective configurations on startup”
  • Good: Extremely simple to implement; requires no new endpoints or dependencies.
  • Bad: Configurations can change at runtime via Spring Cloud Bus events. A startup log quickly becomes stale and is difficult to query when troubleshooting a live incident.

Option 2: Expose a standard Spring @RestController endpoint

Section titled “Option 2: Expose a standard Spring @RestController endpoint”
  • Good: Accessible without requiring Actuator dependencies.
  • Bad: Exposes internal operational state on the same port as business APIs, potentially leading to security leaks. Pollutes the host application’s API namespace.

Option 3 (Chosen): Expose a custom Spring Boot Actuator Endpoint (@Endpoint) with @ConditionalOnClass

Section titled “Option 3 (Chosen): Expose a custom Spring Boot Actuator Endpoint (@Endpoint) with @ConditionalOnClass”
  • Good: Integrates cleanly into existing monitoring stacks; separates management traffic from business traffic; uses reflection to definitively prove what value is currently sitting in memory.
  • Bad: Adds slight complexity to the util-configuration library’s component scanning and classpath assumptions.
  • Conditional Bean Creation Tests: Verified via @SpringBootTest suites without spring-boot-starter-actuator on classpath ensuring the bean context initializes cleanly.
  • Actuator Endpoint Tests: Verified via WebTestClient hitting /actuator/aircommerceConfig ensuring JSON schema matches expected status, defaultValue, and currentValue fields.
  • Security Scans: Automated scans verify that Actuator endpoints are properly isolated to the internal management port and require appropriate administrative roles.
  • Zero Breaking Changes: Microservices without Actuator continue to function without any classpath issues.
  • Observability Integration: Prometheus/Grafana or ops dashboards can optionally ingest this endpoint for platform-wide configuration drift auditing.