[
https://issues.apache.org/jira/browse/CAMEL-24025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Federico Mariani updated CAMEL-24025:
-------------------------------------
Fix Version/s: 4.22.0
> camel-observability-services-starter: ship defaults via
> EnvironmentPostProcessor instead of config/application.properties so users
> can override them
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24025
> URL: https://issues.apache.org/jira/browse/CAMEL-24025
> Project: Camel
> Issue Type: Improvement
> Components: camel-spring-boot-starters
> Reporter: Federico Mariani
> Assignee: Federico Mariani
> Priority: Major
> Fix For: 4.22.0
>
>
> {{camel-observability-services-starter}} packages its opinionated defaults as
> a literal {{config/application.properties}} inside the starter jar:
> https://github.com/apache/camel-spring-boot/blob/main/components-starter/camel-observability-services-starter/src/main/resources/config/application.properties
> Spring Boot's config-data search order is {{classpath:/}} first, then
> {{classpath:/config/}}, with later locations winning. So the starter's file
> silently overrides the same keys in the application's own
> {{application.properties}} — users can only beat it with higher-precedence
> sources (env vars, system properties, external config files). This is the
> root cause of the documented limitation "the customization of the
> configuration for this component is not available for Spring Boot runtime".
> It also means the starter force-overrides {{management.server.port=9876}}
> even when the user sets it, unlike the Camel Main and Quarkus variants where
> defaults are user-overridable. Spring Boot's reference docs on custom
> starters explicitly advise against packaging an
> {{application.properties}}/{{yml}} in a library for exactly these reasons
> (plus classpath-order nondeterminism if two jars ship the same resource path).
> *Proposal:* replace the packaged {{config/application.properties}} with an
> {{EnvironmentPostProcessor}} (registered in {{META-INF/spring.factories}})
> that adds the same keys as a {{MapPropertySource}} via
> {{environment.getPropertySources().addLast(...)}}. Being last, the defaults
> keep working out of the box but every key becomes overridable through normal
> Spring Boot precedence (application properties, profiles, env vars). The
> documented customization limitation can then be removed, aligning the Spring
> Boot behavior with Camel Main and Quarkus.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)