smongiar opened a new pull request, #2078: URL: https://github.com/apache/camel-spring-boot/pull/2078
Cherry-pick of #1951 onto `camel-spring-boot-4.22.x`. **Original PR:** #1951 - CAMEL-24501: Only copy configured starter options onto the Camel target **JIRA:** [CAMEL-24501](https://issues.apache.org/jira/browse/CAMEL-24501) ### What it fixes The generated `*ComponentConfiguration`, `*DataFormatConfiguration` and `*LanguageConfiguration` classes materialise every catalog default as a field initializer. The starter customizer then copied all non-null fields onto the Camel target, so a catalog default was applied even when the application never configured that option. This is visible with `camel-ai-tool-starter` + `camel-mcp-server-starter`. The catalog reports `defaultValue: false` for the nullable `Boolean` MCP hints (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`), the generated configuration initializes them to `false`, and the customizer copies them onto `AiToolComponent`. An `ai-tool:` route that configures no hints is then published over MCP `tools/list` as: ```json "annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false} ``` The hints are tri-state (unset / true / false); unset hints must not be published. The same mechanism also reverts a value set in Java on a bean the application registered, whenever it differs from the catalog default. `CamelPropertiesHelper.copyConfigurationProperties` now copies only the options Spring Boot recorded as bound in `BoundConfigurationProperties` (including the entries of a map or list option). The field initializers stay, so `spring-configuration-metadata` and the generated documentation keep showing the defaults, and nothing generated changes. This is the follow-up that #1960 deliberately left out of the previous 4.22.x backport of this ticket. ### Verification on this branch The commit cherry-picked cleanly (`git cherry-pick -x`, no conflicts). - `core/camel-spring-boot`: `CamelPropertiesHelperTest` (12) and `CamelPropertiesHelperLenientBindingTest` (1) pass; the module builds and its integration tests pass. - `camel-ai-tool-starter`, `camel-mcp-server-starter` and `camel-platform-http-starter` build against it. - End-to-end check with a minimal Spring Boot application (`camel-ai-tool-starter`, `camel-platform-http-starter`, `camel-mcp-server-starter`, an `ai-tool:` route with no hints, `spring.ai.mcp.server.protocol=STREAMABLE`) calling MCP `tools/list`: | Build | Result | |---|---| | `camel-spring-boot-4.22.x` without this change | all four hints published as `false` | | with this change | no `annotations` published | | with this change and `camel.component.ai-tool.read-only-hint=true`, `camel.component.ai-tool.destructive-hint=false` | exactly `readOnlyHint:true` and `destructiveHint:false` published, the other two absent | The full test suites of the other modules are left to CI. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
