Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
4.x
-
None
-
None
-
Unknown
Description
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 :
@Bean("http") public HttpComponent http(){ return ComponentsBuilderFactory.http() .connectionsPerRoute(1). .build(); }
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:
@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; }
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.