davsclaus opened a new pull request, #28140:
URL: https://github.com/apache/camel/pull/28140

   [CAMEL-25858](https://issues.apache.org/jira/browse/CAMEL-25858): in dev 
mode, a properties file that changed configures its components again, and each 
component of the reload is created anew (CAMEL-19071). Two things went wrong:
   
   - **Several options of one component in one save: only the last one was 
set.** `doAutoConfigurationFromProperties` removed and created the component 
for each key, as `MainHelper.computeProperties` calls the supplier once per 
key. Each option was set on another instance, and only the last instance stayed 
in the CamelContext.
   - **An option that did not change was lost.** The reload passes only the 
properties that changed. The new component started from its defaults and got 
only those options.
   
   Found in a benchmark of Oct 19-20 2026: a model added three 
`camel.component.langchain4j-chat.*` options in one save, and the route failed 
with "chatModel must be specified", although the reload logged all three. 
Before CAMEL-25767 (#28123), a `camel run --source-dir=.` reload did not apply 
component options at all, so this did not show.
   
   The change, in `BaseMainSupport`:
   - A component is re-created once per reload, so all the options of the 
reload are set on the new one.
   - Before the components are configured, the reload adds the other current 
options of each component it re-creates. They come from the properties 
component, ENV variables and JVM system properties, as at startup; the options 
of the reload win. The startup reads these in the same new method, 
`loadAutoConfigurationProperties`.
   - Data formats and languages are not affected: a reload configures the 
existing instance.
   
   ## Tests
   
   - New `MainPropertiesReloadComponentTest` (2), through 
`MainPropertiesReload.onChanged`, which the file watcher calls:
     - two options of the log component in one reload are both set;
     - a reload that changes `lazy-start-producer` keeps 
`source-location-logger-name` from the start.
     - Without the change, both fail: the first option of the reload and the 
option from the start are false.
   - All tests of camel-main pass (301), including 
`MainPropertiesReloadBeansTest`.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
   


-- 
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]

Reply via email to