[
https://issues.apache.org/jira/browse/CAMEL-9305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14998620#comment-14998620
]
ASF GitHub Bot commented on CAMEL-9305:
---------------------------------------
GitHub user astefanutti opened a pull request:
https://github.com/apache/camel/pull/673
CAMEL-9305: PropertiesComponent.isDefaultCreated method only check th…
…e absence of defined locations
The method now returns 'false' except but for the default properties
component that gets created
at start time when no component named 'properties' exists. The
implementation intentionally doesn't introduce
any member nor setter in order to avoid any unintended usage of the
isDefaultCreated semantic. The default
properties component that gets created extends PropertiesComponent and
overrides the default implementation.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/astefanutti/camel CAMEL-9305
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/673.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #673
----
commit 30a2163a8eed5d4f741ae7efc8852acb1f4c0026
Author: Antonin Stefanutti <[email protected]>
Date: 2015-11-10T14:00:17Z
CAMEL-9305: PropertiesComponent.isDefaultCreated method only check the
absence of defined locations
The method now returns 'false' except but for the default properties
component that gets created
at start time when no component named 'properties' exists. The
implementation intentionally doesn't introduce
any member nor setter in order to avoid any unintended usage of the
isDefaultCreated semantic. The default
properties component that gets created extends PropertiesComponent and
overrides the default implementation.
----
> 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(...);
> return properties;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)