The OpenTelemetry Spring Boot starter (v2.26.0+) now supports declarative configuration via a YAML schema embedded directly in application.yaml under an otel: key. This post traces how a single environment variable (OTEL_SERVICE_NAME) flows through Spring's property stack, gets normalized, and reaches the SDK. It explains the three stages: Spring's property unification, the bracket-index naming gap the starter bridges manually, and the difference between Spring's ${VAR:default} placeholder resolution and the SDK's own substituter. Practical benefits include replacing @Configuration beans with YAML blocks (e.g., excluding actuator endpoints from tracing), automatic env var overrides without pre-wiring placeholders, and compatibility with Spring profiles and external config servers. The post also covers migration gotchas like Spring Boot 3.5 BOM conflicts and the new DeclarativeConfigurationCustomizerProvider API.

10m read timeFrom opentelemetry.io
Post cover image
Table of contents
A YAML file inside your YAML fileThe wall env vars alone could not climbStage one: arriving at Spring’s property stackStage two: the env var Spring almost lostStage three: two substituters, one syntaxArrival: the resolved tree the SDK actually boots fromWhy “experimental” is the best reason to try declarative config nowGetting there in 60 secondsThe fine print
2.1K Impressions