Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15571

The order of loading settings is changed in the method AbstractLocationPropertiesSource::loadProperties(Predicate)

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.6.0, 3.4.5
    • camel-core
    • None
    • Unknown

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            shmakovaa Shmakov Alexey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: