gnodet opened a new pull request, #2079: URL: https://github.com/apache/camel-spring-boot/pull/2079
## Summary Fixes [CAMEL-26782](https://issues.apache.org/jira/browse/CAMEL-26782): `copyConfigurationProperties` silently dropped values assigned in Java to a generated Spring Boot starter configuration bean. ## Root Cause CAMEL-24501 (PR #1951) changed `CamelPropertiesHelper.copyConfigurationProperties` to only copy properties that Spring Boot recorded in `BoundConfigurationProperties`. This correctly prevents catalog defaults from overwriting values on user-supplied Camel beans. However, `BoundConfigurationProperties` only tracks values set via Spring Boot property binding (application.properties / application.yaml) — it does not track values assigned programmatically in Java. **In-tree example:** `SpringBootPlatformWebMvcConfiguration` sets `requestTimeout` on `PlatformHttpComponentConfiguration` from `spring.mvc.async.request-timeout`. After CAMEL-24501, that value never reached `PlatformHttpComponent` because it was filtered out as though it were an unconfigured catalog default. ## Fix When a property is not in `BoundConfigurationProperties`, compare its current value against a freshly-constructed default instance of the same configuration class. If the value differs from the default, it was assigned programmatically and must be copied to the target Camel bean. Values that match the class default are still treated as unconfigured catalog defaults and dropped — preserving the CAMEL-24501 fix for the original problem. **Key invariants preserved:** - Catalog defaults do not overwrite values on user-supplied beans ✅ - Values configured via application.properties are always applied ✅ - Values configured to their default value via application.properties are still applied ✅ - Values assigned programmatically in Java that differ from the class default are now copied ✅ - Values that equal the class default and are not Spring-bound are still dropped ✅ If the configuration class has no accessible no-arg constructor, the default-comparison falls back to an empty map (effectively treating all non-bound values as programmatic assignments — conservative fallback, same as the pre-CAMEL-24501 behavior for that class). ## Tests Added Two new tests in `CamelPropertiesHelperTest`: - `testCopyConfigurationPropertiesCopiesProgrammaticallyAssignedValue`: verifies that a value set in Java on the configuration class (simulating `SpringBootPlatformWebMvcConfiguration`'s pattern) is copied to the target - `testCopyConfigurationPropertiesDoesNotCopyProgrammaticValueMatchingDefault`: verifies that a programmatically-set value that equals the class default is NOT copied (the target's own value is preserved) --- _This PR was opened by an AI coding agent (Hermes) on behalf of Guillaume Nodet._ -- 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]
