You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Chandrakant Hardahe (Jira)" <ji...@apache.org> on 2020/09/23 12:48:00 UTC

[jira] [Commented] (CAMEL-15571) The order of loading settings is changed in the method AbstractLocationPropertiesSource::loadProperties(Predicate)

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

Chandrakant Hardahe commented on CAMEL-15571:
---------------------------------------------

Thanks [~shmakovaa] for reporting it, I'll work on this

> The order of loading settings is changed in the method AbstractLocationPropertiesSource::loadProperties(Predicate)
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-15571
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15571
>             Project: Camel
>          Issue Type: Task
>          Components: camel-base
>            Reporter: Shmakov Alexey
>            Priority: Major
>
> As a result of copying from OrderedProperties to Properties, the order of properties is changed  
> [https://github.com/apache/camel/blob/master/core/camel-base/src/main/java/org/apache/camel/component/properties/AbstractLocationPropertiesSource.java]
>      public Properties loadProperties(Predicate<String> filter) {       
>         Properties answer = new Properties();
>          for (String name : properties.stringPropertyNames())
> {                            if (filter.test(name))   answer.put(name, properties.get(name));           }
>         return answer;   
>     }  
> So when creating beans from the application.properties file, the order of their creation changes and beans that depend on other beans are created earlier and do not see the desired beans in the registry
>  [https://camel.apache.org/components/latest/others/main.html#_specifying_custom_beans]  
>  
> For example, in this  application.properties
>  
>   #bus config
>   camel.beans.busConFactory=#class:org.apache.activemq.ActiveMQConnectionFactory
>   camel.beans.busConFactory.brokerURL=vm://amq-test-bus?broker.persistent=false
>   camel.beans.busPoolFactory=#class:org.apache.activemq.pool.PooledConnectionFactory
>   camel.beans.busPoolFactory.connectionFactory=#busConFactory
>   camel.beans.busPoolFactory.maxConnections=3
>   camel.beans.busJmsConfig=#class:org.apache.camel.component.activemq.ActiveMQConfiguration
>   camel.beans.busJmsConfig.connectionFactory=#busPoolFactory
>   camel.beans.busJmsConfig.concurrentConsumers=2
>   camel.beans.busJmsConfig.preserveMessageQos=true
>   camel.beans.busJmsConfig.transacted=true
>   camel.beans.BUS=#class:org.apache.camel.component.activemq.ActiveMQComponent
>   camel.beans.BUS.configuration=#busJmsConfig
>  
> Bean "camel.beans.BUS" created before "camel.beans.busJmsConfig" and it did not work



--
This message was sent by Atlassian Jira
(v8.3.4#803005)