Skip to content

CAMEL-24025: ship observability-services defaults via EnvironmentPostProcessor#1847

Merged
Croway merged 1 commit into
apache:mainfrom
Croway:CAMEL-24025-observability-defaults-env-post-processor
Jul 13, 2026
Merged

CAMEL-24025: ship observability-services defaults via EnvironmentPostProcessor#1847
Croway merged 1 commit into
apache:mainfrom
Croway:CAMEL-24025-observability-defaults-env-post-processor

Conversation

@Croway

@Croway Croway commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Resolves CAMEL-24025

What

camel-observability-services-starter packaged its opinionated defaults as a literal config/application.properties inside the starter jar. Spring Boot's config-data search gives classpath:/config/application.properties higher precedence than the application's own classpath:/application.properties, so the starter defaults silently overrode user settings — customization was only possible via environment variables or system properties, and this limitation was even documented in the component docs (referencing spring-projects/spring-boot#24688).

This PR replaces the packaged properties file with an ObservabilityServicesEnvironmentPostProcessor registered via META-INF/spring.factories. It contributes the exact same defaults as a MapPropertySource added with addLast(...) (running at Ordered.LOWEST_PRECEDENCE, i.e. after ConfigDataEnvironmentPostProcessor), so the defaults sit at the bottom of the environment and every user-provided source overrides them following standard Spring Boot precedence rules. This aligns the behaviour with the Camel Main and Quarkus variants of camel-observability-services.

Behavioural change

Previously the packaged defaults won over the user's application.properties; now the user's configuration wins. This is the intent of the ticket, but applications that set e.g. management.server.port and silently got 9876 anyway will now get their own value.

Tests

New ObservabilityServicesEnvironmentPostProcessorTest:

  • defaultsAreApplied — all defaults resolve from the environment when not overridden
  • userApplicationPropertiesOverrideDefaults — values from a regular application.properties win over the starter defaults (this assertion fails against the previous packaged-file mechanism)

Follow-up

The WARNING in the camel-observability-services docs (apache/camel, observability-services.adoc) stating that customization is not available on Spring Boot becomes obsolete once this is merged — will follow up with a docs PR in apache/camel.


This PR was generated by Claude Code on behalf of Federico Mariani

🤖 Generated with Claude Code

…Processor

Replace the packaged config/application.properties in
camel-observability-services-starter with an EnvironmentPostProcessor that
registers the same defaults as the lowest precedence property source. The
packaged file was loaded from classpath:/config/ which silently overrode the
user's own application.properties; with this change the defaults follow the
standard Spring Boot precedence rules and can be overridden by any
user-provided configuration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Croway Croway changed the title CAMEL-24025: ship observability-services defaults via EnvironmentPost… CAMEL-24025: ship observability-services defaults via EnvironmentPostProcessor Jul 12, 2026
@Croway Croway requested review from gzurowski, oscerd and squakez and removed request for gzurowski July 12, 2026 12:13

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to spot this so we have good usability on SB

@Croway Croway merged commit c2728c0 into apache:main Jul 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants