You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Dhiraj Bokde (JIRA)" <ji...@apache.org> on 2016/08/31 06:44:20 UTC

[jira] [Reopened] (CAMEL-10197) camel-spring-boot - Extend the configuration hints to nested properties

     [ https://issues.apache.org/jira/browse/CAMEL-10197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dhiraj Bokde reopened CAMEL-10197:
----------------------------------
      Assignee: Dhiraj Bokde  (was: Nicola Ferraro)

So, this solution is really suboptimal, and it's related to another issue about not being able to handle other nested bean properties. 
Spring boot supports adding {{@NestedConfigurationProperty}}, which will allow users to set nested properties like so:
{code}
component.property1.property2=xyz
{code}
So, I have pretty much solved this on a local branch on my machine, just need to sort out some details. The way it works in my proposed solution is:
* The solution basically marks all component properties that are not in {{'java.*}} and {{javax.*}} package as {{@NestedConfigurationProperty}}, except for nested beans with source in the same component project. 
* Those get mapped to nested classes and include Javadoc from setter properties. So {{*EndpointConfig}} classes get handled nicely. 
* It even handles {{@UriParam}} and {{@UriPath}}'s {{defaultValue}} property. 

The questions I have are:
* Do we support setting beans refs right now, I couldn't tell if we did or not? Do bean refs even make any sense for Spring Boot? 
* Is it ok to mark all bean types as {{@NestedConfigurationProperty}}? I have seen some weird stuff happening, like {{SalesforceHttpClient}} property being exposed as a nested class. But then I realized that it's actually a good thing and works well for some settings. 

Do you guys see any concerns with this approach? The current approach of flattening out endpoint properties is basically an anti-pattern. There could even be issues with property names clashes, etc. on top of being a manual and an error prone process for a significant number of existing components, and components to come. 

> camel-spring-boot - Extend the configuration hints to nested properties
> -----------------------------------------------------------------------
>
>                 Key: CAMEL-10197
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10197
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring-boot
>            Reporter: Nicola Ferraro
>            Assignee: Dhiraj Bokde
>
> Support for spring-boot configuration allows users to configure the component properties but does not give any hint on nested properties.
> There are many components that declare properties on nested beans.
> Eg. camel-docker has only one property named _configuration_ .  I found this pattern in components that allow users to specify a default value on the component and override it on each endpoint, if necessary.
> Setting the property:
> {code}
> camel.component.docker.configuration.host=172.28.128.4
> {code}
> allows a user to specify the docker host, but the tooling does not give suggestions about that property.
> A way to allow the users to view the nested properties is using the {{NestedConfigurationProperty}} annotation on the spring-boot configuration class. The spring-boot inspector will scan the nested class for properties.
> The drawback is that the javadoc is not read from setters. Another drawback is that we will be using a different approach respect to the "read-the-json" one.
> We need to figure out how to add these properties.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)