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

PropertiesComponent.isDefaultCreated method only check the absence of defined locations

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.16.0
    • 2.17.0
    • camel-core
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: