[ 
https://issues.apache.org/jira/browse/CAMEL-20290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18151679#comment-18151679
 ] 

Claus Ibsen commented on CAMEL-20290:
-------------------------------------

This is fixed in camel-spring-boot by CAMEL-24501 (4.18.5 / 4.22.1 / 4.23.0) 
and CAMEL-26782 (4.22.3 / 4.24.0). The
starter customizer now uses 
`CamelPropertiesHelper.copyConfigurationProperties`, which copies only the 
options set in
`application.properties` (or assigned in Java) and no longer resets an option 
such as `connectionsPerRoute` that is
only at its default. An option that is set in both places is taken from the 
properties. Closing as done.

_Claude Code on behalf of davsclaus_

> Camel Spring Boot Starters configuration in Java and ConfigurationProperties 
> conflict
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-20290
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20290
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring-boot
>    Affects Versions: 4.x
>            Reporter: John Poth
>            Priority: Minor
>
> It would be cool if we could find a way to reconcile:
> 1) Starter configurations via _ConfigurationProperties_
> 2) Stater configurations in Java
> in a way that's clear for the user. For example the following configuration 
> attempt in Java fails :
> {code:java}
> @Bean("http")
> public HttpComponent http(){
>     return ComponentsBuilderFactory.http()
>                         .connectionsPerRoute(1).
>                         .build();
> }
> {code}
> As the _ConfigurationProperties_ kicks in afterwards and the 
> _connectionsPerRoute_ will be set to the default 20 at runtime. The user can 
> disable this by setting camel.component.http.customizer.enabled=false but 
> that removes the ability to configure the component from 
> application.properties files etc...
> A workaround could be something like:
> {code:java}
>     @Bean("http")
>     public HttpComponent myHttp(HttpComponentConfiguration config, 
> CamelContext camelContext) {
>         HttpComponent httpComponent = new HttpComponent();
>         httpComponent.setCamelContext(camelContext);
>         // copy external configuration
>         CamelPropertiesHelper.copyProperties(camelContext, config, 
> httpComponent);
>         // Custom config
>         httpComponent.setConnectionsPerRoute(1);
>         return httpComponent;
>     }
> {code}
> It would be also cool to have a clear priority order e.g if 
> _connectionsPerRoute_ is set in Java and application.properties which takes 
> precedence. Also, configuring multiple instances of the same component comes 
> to mind.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to