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

PropertiesComponent.isDefaultCreated method only check the absence of defined locations

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.16.0
    • Fix Version/s: 2.17.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      In some situations, Camel falls back to creating a default PropertiesComponent and emits the following log statement when a configuration property resolution fails:

      PropertiesComponent with name properties must be defined in CamelContext to support property placeholders. Property with key [foo] not found in properties from text: {{foo}}
      

      The first sentence is logged when the PropertiesComponent.isDefaultCreated method returns true which indicates that Camel has created this component on its own. However, as the current implementation solely relies on whether a location has been set on the component, this leads to some situations where that sentence is logged while the end-user has actually registered a PropertiesComponent with the name properties.

      This happens in the following examples among others:

      @Produces
      @ApplicationScoped
      @Named("properties")
      PropertiesComponent configuration() {
          Properties properties = new Properties();
          properties.put("foo", "bar");
          PropertiesComponent component = new PropertiesComponent();
          component.setInitialProperties(properties);
          return component;
      }
      
      @Bean
      PropertiesComponent properties() {
          PropertiesComponent properties = new PropertiesComponent();
          properties.setPropertiesParser(...);
          return properties;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              antonin.stefanutti Antonin Stefanutti
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: