[
https://issues.apache.org/jira/browse/CAMEL-9305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Antonin Stefanutti updated CAMEL-9305:
--------------------------------------
Description:
In some situations, Camel falls back to creating a default
{{PropertiesComponent}} and emits the following log statement when a
configuration property resolution fails:
{code}
PropertiesComponent with name properties must be defined in CamelContext to
support property placeholders. Property with key [foo] not found in properties
from text: {{foo}}
{code}
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:
{code}
@Produces
@ApplicationScoped
@Named("properties")
PropertiesComponent configuration() {
Properties properties = new Properties();
properties.put("foo", "bar");
PropertiesComponent component = new PropertiesComponent();
component.setInitialProperties(properties);
return component;
}
{code}
{code}
@Bean
PropertiesComponent properties() {
PropertiesComponent properties = new PropertiesComponent();
properties.setPropertiesParser(propertiesParser());
return properties;
}
{code}
was:
In some situations, Camel falls back to creating a default
{{PropertiesComponent}} and emits the following log statement when a
configuration property resolution fails:
{code}
PropertiesComponent with name properties must be defined in CamelContext to
support property placeholders. Property with key [foo] not found in properties
from text: {{foo}}
{code}
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}}, for example:
{code}
@Produces
@ApplicationScoped
@Named("properties")
PropertiesComponent configuration() {
Properties properties = new Properties();
properties.put("foo", "bar");
PropertiesComponent component = new PropertiesComponent();
component.setInitialProperties(properties);
return component;
}
{code}
> PropertiesComponent.isDefaultCreated method only check the absence of defined
> locations
> ---------------------------------------------------------------------------------------
>
> Key: CAMEL-9305
> URL: https://issues.apache.org/jira/browse/CAMEL-9305
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Affects Versions: 2.16.0
> Reporter: Antonin Stefanutti
> Priority: Minor
> Fix For: 2.17.0
>
>
> In some situations, Camel falls back to creating a default
> {{PropertiesComponent}} and emits the following log statement when a
> configuration property resolution fails:
> {code}
> PropertiesComponent with name properties must be defined in CamelContext to
> support property placeholders. Property with key [foo] not found in
> properties from text: {{foo}}
> {code}
> 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:
> {code}
> @Produces
> @ApplicationScoped
> @Named("properties")
> PropertiesComponent configuration() {
> Properties properties = new Properties();
> properties.put("foo", "bar");
> PropertiesComponent component = new PropertiesComponent();
> component.setInitialProperties(properties);
> return component;
> }
> {code}
> {code}
> @Bean
> PropertiesComponent properties() {
> PropertiesComponent properties = new PropertiesComponent();
> properties.setPropertiesParser(propertiesParser());
> return properties;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)