Modified: websites/production/camel/content/properties.html
==============================================================================
--- websites/production/camel/content/properties.html (original)
+++ websites/production/camel/content/properties.html Wed Feb  1 21:20:51 2017
@@ -96,7 +96,7 @@
 </div></div><p>where <strong><code>file.uri</code></strong> is the property 
key.</p><p>Property placeholders can be used to specify parts, or all, of an 
endpoint's URI by embedding one or more placeholders in the URI's string 
definition.</p><p>From&#160;<strong>Camel 2.14.1</strong>: you can specify a 
default value to use if a property with the key does not exists, e.g., 
<strong><code>file.url:/some/path</code></strong> where the default value is 
the text after the colon, e.g., 
<strong><code>/some/path</code></strong>.</p><div 
class="confluence-information-macro 
confluence-information-macro-information"><span class="aui-icon aui-icon-small 
aui-iconfont-info confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>From <strong>Camel 
2.14.1</strong>: do <em>not</em> use a colon in the property key. The colon 
character is used as a token separator when providing a default 
value.</p></div></div><h3 id="Properties-UsingPropertyResolver">Using&#160;<code
 >PropertyResolver</code></h3><p>Camel provides a pluggable mechanism that 
 >allows third-parties to specify their own resolver to use for the lookup of 
 >properties.</p><p>Camel provides a default implementation 
 ><strong><code>org.apache.camel.component.properties.DefaultPropertiesResolver</code></strong>
 > which is capable of loading properties from the file system, classpath or <a 
 >shape="rect" href="registry.html">Registry</a>. To indicate which source to 
 >use the location must contain the appropriate prefix.</p><p>The list of 
 >prefixes is:</p><div class="table-wrap"><table 
 >class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
 >class="confluenceTh"><p>Prefix</p></th><th colspan="1" rowspan="1" 
 >class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>ref:</code></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p>Lookup in the <a shape="rect" 
 >href="registry.html">Registry.</a></p></td></tr><tr><td colspan="1" 
 >rowspan="1" 
 class="confluenceTd"><p><code>file:</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Load the from file system.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>classpath:</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Load from the classpath (this is also the 
default if no prefix is provided).</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>blueprint:</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Use a specific OSGi blueprint placeholder 
service.</p></td></tr></tbody></table></div><h3 
id="Properties-DefiningLocation">Defining Location</h3><p>The 
<strong><code>PropertiesResolver</code></strong> must be configured with the 
location(s) to use when resolving properties. One or more locations can be 
given. Specifying multiple locations can be done a couple of ways: using either 
a single comma separated string, or an array of strings.</p><div class="code 
panel pdl" style="borde
 r-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[pc.setLocation(&quot;com/mycompany/myprop.properties,com/mycompany/other.properties&quot;);
 pc.setLocation(new String[] {&quot;com/mycompany/myprop.properties&quot;, 
&quot;com/mycompany/other.properties&quot;}); ]]></script>
-</div></div><div><p>&#160;</p><p>From<strong> Camel 2.19.0</strong>: you can 
set which location can be discarded if missing by setting&#160; 
<strong><code>optional=true</code></strong>, 
(<strong><code>false</code></strong> by 
default).</p><p>Example:</p></div><div><p>&#160;</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><div><p>From<strong> Camel 2.19.0</strong>: you can set which 
location can be discarded if missing by setting&#160; 
<strong><code>optional=true</code></strong>, 
(<strong><code>false</code></strong> by 
default).</p><p>Example:</p></div><div><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[pc.setLocations(&quot;com/mycompany/override.properties;optional=true,com/mycompany/defaults.properties&quot;);]]></script>
 </div></div><p>&#160;</p></div><h4 
id="Properties-UsingSystemandEnvironmentVariablesinLocations">Using System and 
Environment Variables in Locations</h4><p><strong>Available as of Camel 
2.7</strong></p><p>The location now supports using placeholders for JVM system 
properties and OS environments variables.</p><p>Example:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[location=file:${karaf.home}/etc/foo.properties
@@ -346,7 +346,7 @@ assertMockEndpointsSatisfied();
         &lt;/route&gt;
     &lt;/camelContext&gt;
 &lt;/blueprint&gt;]]></script>
-</div></div><p><span style="line-height: 1.42857;"><br 
clear="none"></span></p><p><span style="line-height: 1.42857;">By default Camel 
detects and uses OSGi blueprint property placeholder service. You can disable 
this by setting the attribute </span><strong><code style="line-height: 
1.42857;">useBlueprintPropertyResolver</code></strong><span style="line-height: 
1.42857;"> to false on the </span><strong><code style="line-height: 
1.42857;">&lt;camelContext&gt;</code></strong><span style="line-height: 
1.42857;"> definition.</span></p><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">About placeholder 
syntaxes</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Notice how we can use the Camel 
syntax for placeholders&#160;<code><strong>{{</strong> 
<strong>}}</strong></code> in the Camel route, which will lookup the value from 
OSGi blueprint.<
 br clear="none"> The blueprint syntax for placeholders is 
<strong><code>${}</code></strong>. So outside 
the&#160;<strong><code>&lt;camelContext&gt;</code></strong> you must use 
the&#160;<strong><code>${}</code></strong> syntax. Where as 
inside&#160;<strong><code>&lt;camelContext&gt;</code></strong> you must 
use&#160;<code><strong>{{</strong> <strong>}}</strong></code> syntax. OSGi 
blueprint allows you to configure the syntax, so you can actually align those 
if you want.</p></div></div><p>You can also explicit refer to a specific OSGi 
blueprint property placeholder by its id. For that you need to use the 
Camel's&#160;<strong><code>&lt;propertyPlaceholder&gt;</code></strong> as shown 
in the example below:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><p><span style="line-height: 1.42857;">By default Camel detects 
and uses OSGi blueprint property placeholder service. You can disable this by 
setting the attribute </span><strong><code style="line-height: 
1.42857;">useBlueprintPropertyResolver</code></strong><span style="line-height: 
1.42857;"> to false on the </span><strong><code style="line-height: 
1.42857;">&lt;camelContext&gt;</code></strong><span style="line-height: 
1.42857;"> definition.</span></p><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">About placeholder 
syntaxes</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Notice how we can use the Camel 
syntax for placeholders&#160;<code><strong>{{</strong> 
<strong>}}</strong></code> in the Camel route, which will lookup the value from 
OSGi blueprint.<br clear="none"> The blueprint syntax for placeholders is 
<strong><
 code>${}</code></strong>. So outside 
the&#160;<strong><code>&lt;camelContext&gt;</code></strong> you must use 
the&#160;<strong><code>${}</code></strong> syntax. Where as 
inside&#160;<strong><code>&lt;camelContext&gt;</code></strong> you must 
use&#160;<code><strong>{{</strong> <strong>}}</strong></code> syntax. OSGi 
blueprint allows you to configure the syntax, so you can actually align those 
if you want.</p></div></div><p>You can also explicit refer to a specific OSGi 
blueprint property placeholder by its id. For that you need to use the 
Camel's&#160;<strong><code>&lt;propertyPlaceholder&gt;</code></strong> as shown 
in the example below:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;blueprint 
xmlns=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot;
            xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
            
xmlns:cm=&quot;http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0&quot;
@@ -374,7 +374,7 @@ assertMockEndpointsSatisfied();
         &lt;/route&gt;
     &lt;/camelContext&gt;
 &lt;/blueprint&gt;]]></script>
-</div></div><p>&#160;</p><p>Notice how we use the 
<strong><code>blueprint</code></strong> scheme to refer to the OSGi blueprint 
placeholder by its id. This allows you to mix and match, for example you can 
also have additional schemes in the location. For example to load a file from 
the classpath you can do:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Notice how we use the <strong><code>blueprint</code></strong> 
scheme to refer to the OSGi blueprint placeholder by its id. This allows you to 
mix and match, for example you can also have additional schemes in the 
location. For example to load a file from the classpath you can do:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[location=&quot;blueprint:myblueprint.placeholder,classpath:myproperties.properties&quot;
 ]]></script>
 </div></div><p>Each location is separated by comma.</p><h4 
id="Properties-OverridingBlueprintPropertyPlaceholdersOutsideCamelContext">Overriding
 Blueprint Property Placeholders Outside CamelContext</h4><p><strong>Available 
as of Camel 2.10.4</strong></p><p>When using Blueprint property placeholder in 
the Blueprint XML file, you can declare the properties directly in the XML file 
as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
@@ -402,7 +402,7 @@ assertMockEndpointsSatisfied();
 
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>&#160;<p>Notice that we have 
a&#160;<strong><code>&lt;bean&gt;</code></strong> which refers to one of the 
properties. And in the Camel route we refer to the other using 
the&#160;<strong><code>{{ }}</code></strong> notation.</p><p>Now if you want to 
override these Blueprint properties from an unit test, you can do this as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div>Notice that we have 
a&#160;<strong><code>&lt;bean&gt;</code></strong> which refers to one of the 
properties. And in the Camel route we refer to the other using 
the&#160;<strong><code>{{ }}</code></strong> notation.<p>Now if you want to 
override these Blueprint properties from an unit test, you can do this as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 @Override
 protected String useOverridePropertiesWithConfigAdmin(Dictionary props) {
@@ -413,7 +413,7 @@ protected String useOverridePropertiesWi
     return &quot;my-placeholders&quot;;
 }
 ]]></script>
-</div></div>&#160;<p>To do this we override and implement the 
<strong><code>useOverridePropertiesWithConfigAdmin</code></strong> method. We 
can then put the properties we want to override on the given props parameter. 
And the return value <em>must</em> be the persistence-id of 
the&#160;<strong><code>&lt;cm:property-placeholder&gt;</code></strong> tag, 
which you define in the blueprint XML file.</p><h4 
id="Properties-Usinga.cfgor.propertiesFileforBlueprintPropertyPlaceholders">Using
 a <code>.cfg</code> or&#160;<code>.properties</code> File for Blueprint 
Property Placeholders</h4><p><strong>Available as of Camel 
2.10.4</strong></p><p>When using Blueprint property placeholder in the 
Blueprint XML file, you can declare the properties in a .properties 
or&#160;<strong><code>.cfg</code></strong> file. If you use Apache 
ServiceMix/Karaf then this container has a convention that it loads the 
properties from a file in the etc directory with the naming 
<strong><code>etc/pid.cfg</code></strong>
 , where&#160;<strong><code>pid</code></strong> is the 
persistence-id.</p><p>For example in the blueprint XML file we have the 
<strong><code>persistence-id="stuff"</code></strong>, which mean it will load 
the configuration file as <strong><code>etc/stuff.cfg</code></strong>.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div>To do this we override and implement the 
<strong><code>useOverridePropertiesWithConfigAdmin</code></strong> method. We 
can then put the properties we want to override on the given props parameter. 
And the return value <em>must</em> be the persistence-id of 
the&#160;<strong><code>&lt;cm:property-placeholder&gt;</code></strong> tag, 
which you define in the blueprint XML file.<h4 
id="Properties-Usinga.cfgor.propertiesFileForBlueprintPropertyPlaceholders">Using
 a <code>.cfg</code> or&#160;<code>.properties</code> File For Blueprint 
Property Placeholders</h4><p><strong>Available as of Camel 
2.10.4</strong></p><p>When using Blueprint property placeholder in the 
Blueprint XML file, you can declare the properties in a .properties 
or&#160;<strong><code>.cfg</code></strong> file. If you use Apache 
ServiceMix/Karaf then this container has a convention that it loads the 
properties from a file in the etc directory with the naming 
<strong><code>etc/pid.cfg</code></strong>, where&#160;
 <strong><code>pid</code></strong> is the persistence-id.</p><p>For example in 
the blueprint XML file we have the 
<strong><code>persistence-id="stuff"</code></strong>, which mean it will load 
the configuration file as <strong><code>etc/stuff.cfg</code></strong>.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;!-- blueprint property placeholders, that will use etc/stuff.cfg as the 
properties file --&gt;
 &lt;cm:property-placeholder persistent-id=&quot;stuff&quot; 
update-strategy=&quot;reload&quot;/&gt;
@@ -433,7 +433,7 @@ protected String useOverridePropertiesWi
 
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>&#160;<p>Now if you want to unit test this blueprint XML file, 
then you can override the 
<strong><code>loadConfigAdminConfigurationFile</code></strong> and tell Camel 
which file to load as shown below:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Now if you want to unit test this blueprint XML file, then you can 
override the <strong><code>loadConfigAdminConfigurationFile</code></strong> and 
tell Camel which file to load as shown below:<div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 @Override
 protected String[] loadConfigAdminConfigurationFile() {
@@ -442,7 +442,7 @@ protected String[] loadConfigAdminConfig
     return new String[]{&quot;src/test/resources/etc/stuff.cfg&quot;, 
&quot;stuff&quot;};
 }
 ]]></script>
-</div></div>&#160;<p>Notice that this method requires to return 
a&#160;<strong><code>String[]</code></strong> with 2 values. The 1st value is 
the path for the configuration file to load. The second value is the 
persistence-id of 
the&#160;<strong><code>&lt;cm:property-placeholder&gt;</code></strong> 
tag.</p><p>The&#160;<strong><code>stuff.cfg</code></strong> file is just a 
plain properties file with the property placeholders such as:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div>Notice that this method requires to return 
a&#160;<strong><code>String[]</code></strong> with 2 values. The 1st value is 
the path for the configuration file to load. The second value is the 
persistence-id of 
the&#160;<strong><code>&lt;cm:property-placeholder&gt;</code></strong> 
tag.<p>The&#160;<strong><code>stuff.cfg</code></strong> file is just a plain 
properties file with the property placeholders such as:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[## this is a comment
 greeting=Bye
 ]]></script>
@@ -484,7 +484,7 @@ greeting=Bye
 
 &lt;/blueprint&gt;
 ]]></script>
-</div></div>&#160;<p>And in the unit test class we do as follows:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div>And in the unit test class we do as follows:<div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 /**
  * This example will load a Blueprint .cfg file (which will initialize 
configadmin), and also override its property
@@ -529,7 +529,7 @@ public class ConfigAdminLoadConfiguratio
 
 }
 ]]></script>
-</div></div>&#160;<p>And the <strong><code>etc/stuff.cfg</code></strong> 
configuration file contains:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>And the <strong><code>etc/stuff.cfg</code></strong> configuration 
file contains:<div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[greeting=Bye
 echo=Yay
 destination=mock:result
@@ -544,7 +544,7 @@ destination=mock:result
 &lt;/bean&gt;
 
 ]]></script>
-</div></div>&#160;<p>You <strong>must not</strong> use the 
spring&#160;<strong><code>&lt;context:property-placeholder&gt;</code></strong> 
namespace at the same time; this is not possible.</p><p>After declaring this 
bean, you can define property placeholders using both the Spring style, and the 
Camel style within the&#160;<strong><code>&lt;camelContext&gt;</code></strong> 
tag as shown below:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Using bridge property placeholders</b></div><div class="codeContent 
panelContent pdl">
+</div></div>You <strong>must not</strong> use the 
spring&#160;<strong><code>&lt;context:property-placeholder&gt;</code></strong> 
namespace at the same time; this is not possible.<p>After declaring this bean, 
you can define property placeholders using both the Spring style, and the Camel 
style within the&#160;<strong><code>&lt;camelContext&gt;</code></strong> tag as 
shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Using 
bridge property placeholders</b></div><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 
 &lt;!-- a bean that uses Spring property placeholder --&gt;
@@ -563,7 +563,7 @@ destination=mock:result
 &lt;/camelContext&gt;
 
 ]]></script>
-</div></div>&#160;<p>Notice how the hello bean is using pure Spring property 
placeholders using the&#160;<strong><code>${}</code></strong> notation. And in 
the Camel routes we use the Camel placeholder notation with <strong><code>{{ 
}}</code></strong>.</p><h4 
id="Properties-ClashingSpringPropertyPlaceholderswithCamelsLanguage">Clashing 
Spring Property Placeholders with Camels <a shape="rect" 
href="simple.html">Simple</a> Language</h4><p>Take notice when using Spring 
bridging placeholder then the spring&#160;<strong><code>${}</code></strong> 
syntax clashes with the <a shape="rect" href="simple.html">Simple</a> in Camel, 
and therefore take care.</p><p>Example:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Notice how the hello bean is using pure Spring property 
placeholders using the&#160;<strong><code>${}</code></strong> notation. And in 
the Camel routes we use the Camel placeholder notation with <strong><code>{{ 
}}</code></strong>.<h4 
id="Properties-ClashingSpringPropertyPlaceholderswithCamelsLanguage">Clashing 
Spring Property Placeholders with Camels <a shape="rect" 
href="simple.html">Simple</a> Language</h4><p>Take notice when using Spring 
bridging placeholder then the spring&#160;<strong><code>${}</code></strong> 
syntax clashes with the <a shape="rect" href="simple.html">Simple</a> in Camel, 
and therefore take care.</p><p>Example:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;setHeader 
headerName=&quot;Exchange.FILE_NAME&quot;&gt;
   &lt;simple&gt;{{file.rootdir}}/${in.header.CamelFileName}&lt;/simple&gt;
 &lt;/setHeader&gt;
@@ -584,7 +584,7 @@ protected Properties useOverrideProperti
     return extra;
 }
 ]]></script>
-</div></div>&#160;<p>This can be done from any of the Camel Test kits, such as 
<strong><code>camel-test</code></strong>, 
<strong><code>camel-test-spring</code></strong> and 
<strong><code>camel-test-blueprint</code></strong>.</p><p>The 
<strong><code>ignoreMissingLocationWithPropertiesComponent</code></strong> can 
be used to instruct Camel to ignore any locations which was not discoverable. 
For example if you run the unit test, in an environment that does not have 
access to the location of the properties.</p><h3 
id="Properties-Using@PropertyInject">Using&#160;<code>@PropertyInject</code></h3><p><strong>Available
 as of Camel 2.12</strong></p><p>Camel allows to inject property placeholders 
in POJOs using the&#160;<strong><code>@PropertyInject</code></strong> 
annotation which can be set on fields and setter methods. For example you can 
use that with <strong><code>RouteBuilder</code></strong> classes, such as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div clas
 s="codeContent panelContent pdl">
+</div></div>This can be done from any of the Camel Test kits, such as 
<strong><code>camel-test</code></strong>, 
<strong><code>camel-test-spring</code></strong> and 
<strong><code>camel-test-blueprint</code></strong>.<p>The 
<strong><code>ignoreMissingLocationWithPropertiesComponent</code></strong> can 
be used to instruct Camel to ignore any locations which was not discoverable. 
For example if you run the unit test, in an environment that does not have 
access to the location of the properties.</p><h3 
id="Properties-Using@PropertyInject">Using&#160;<code>@PropertyInject</code></h3><p><strong>Available
 as of Camel 2.12</strong></p><p>Camel allows to inject property placeholders 
in POJOs using the&#160;<strong><code>@PropertyInject</code></strong> 
annotation which can be set on fields and setter methods. For example you can 
use that with <strong><code>RouteBuilder</code></strong> classes, such as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeConten
 t panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[public class MyRouteBuilder extends 
RouteBuilder {
 
     @PropertyInject(&quot;hello&quot;)
@@ -622,17 +622,17 @@ private int timeout;
     &lt;to uri=&quot;{{sys:MyJvmPropertyName:log:bar}}&quot;/&gt;
   &lt;/route&gt;
 &lt;/camelContext&gt;]]></script>
-</div></div><p>&#160;</p><p>The service function is for looking up a service 
which is defined using OS environment variables using the service naming idiom, 
to refer to a service location using&#160;<strong><code>hostname : 
port</code></strong></p><ul><li><em><code>NAME</code></em><strong><code>_SERVICE_HOST</code></strong></li><li><em><code>NAME</code></em><strong><code>_SERVICE_PORT</code></strong></li></ul><p>in
 other words the service uses&#160;<strong><code>_SERVICE_HOST</code></strong> 
and&#160;<strong><code>_SERVICE_PORT</code></strong> as prefix. So if the 
service is named <strong><code>FOO</code></strong>, then the OS environment 
variables should be set as</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The service function is for looking up a service which is 
defined using OS environment variables using the service naming idiom, to refer 
to a service location using&#160;<strong><code>hostname : 
port</code></strong></p><ul><li><em><code>NAME</code></em><strong><code>_SERVICE_HOST</code></strong></li><li><em><code>NAME</code></em><strong><code>_SERVICE_PORT</code></strong></li></ul><p>in
 other words the service uses&#160;<strong><code>_SERVICE_HOST</code></strong> 
and&#160;<strong><code>_SERVICE_PORT</code></strong> as prefix. So if the 
service is named <strong><code>FOO</code></strong>, then the OS environment 
variables should be set as</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[export $FOO_SERVICE_HOST=myserver
 export $FOO_SERVICE_PORT=8888]]></script>
-</div></div><p>&#160;</p><p>For example if 
the&#160;<strong><code>FOO</code></strong> service a remote HTTP service, then 
we can refer to the service in the Camel endpoint URI, and use the&#160;<a 
shape="rect" href="http.html">HTTP</a>&#160;component to make the HTTP 
call:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>For example if the&#160;<strong><code>FOO</code></strong> 
service a remote HTTP service, then we can refer to the service in the Camel 
endpoint URI, and use the&#160;<a shape="rect" 
href="http.html">HTTP</a>&#160;component to make the HTTP call:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
   &lt;route&gt;
     &lt;from uri=&quot;direct:start&quot;/&gt;
     &lt;to uri=&quot;http://{{service:FOO}}/myapp&quot;/&gt;
   &lt;/route&gt;
 &lt;/camelContext&gt;]]></script>
-</div></div><p>&#160;</p><p>And we can use default values if the service has 
not been defined, for example to call a service on localhost, maybe for unit 
testing etc:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>And we can use default values if the service has not been 
defined, for example to call a service on localhost, maybe for unit testing 
etc:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
   &lt;route&gt;
     &lt;from uri=&quot;direct:start&quot;/&gt;

Modified: websites/production/camel/content/using-propertyplaceholder.html
==============================================================================
--- websites/production/camel/content/using-propertyplaceholder.html (original)
+++ websites/production/camel/content/using-propertyplaceholder.html Wed Feb  1 
21:20:51 2017
@@ -91,7 +91,7 @@
 </div></div><p>where <strong><code>file.uri</code></strong> is the property 
key.</p><p>Property placeholders can be used to specify parts, or all, of an 
endpoint's URI by embedding one or more placeholders in the URI's string 
definition.</p><p>From&#160;<strong>Camel 2.14.1</strong>: you can specify a 
default value to use if a property with the key does not exists, e.g., 
<strong><code>file.url:/some/path</code></strong> where the default value is 
the text after the colon, e.g., 
<strong><code>/some/path</code></strong>.</p><div 
class="confluence-information-macro 
confluence-information-macro-information"><span class="aui-icon aui-icon-small 
aui-iconfont-info confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>From <strong>Camel 
2.14.1</strong>: do <em>not</em> use a colon in the property key. The colon 
character is used as a token separator when providing a default 
value.</p></div></div><h3 id="UsingPropertyPlaceholder-UsingPropertyResolver">Us
 ing&#160;<code>PropertyResolver</code></h3><p>Camel provides a pluggable 
mechanism that allows third-parties to specify their own resolver to use for 
the lookup of properties.</p><p>Camel provides a default implementation 
<strong><code>org.apache.camel.component.properties.DefaultPropertiesResolver</code></strong>
 which is capable of loading properties from the file system, classpath or <a 
shape="rect" href="registry.html">Registry</a>. To indicate which source to use 
the location must contain the appropriate prefix.</p><p>The list of prefixes 
is:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th 
colspan="1" rowspan="1" class="confluenceTh"><p>Prefix</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>ref:</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Lookup in the <a shape="rect" 
href="registry.html">Registry.</a></p></td></tr><tr><td colspan="1
 " rowspan="1" class="confluenceTd"><p><code>file:</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Load the from file 
system.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>classpath:</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Load from the classpath (this is also the 
default if no prefix is provided).</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>blueprint:</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Use a specific OSGi blueprint placeholder 
service.</p></td></tr></tbody></table></div><h3 
id="UsingPropertyPlaceholder-DefiningLocation">Defining Location</h3><p>The 
<strong><code>PropertiesResolver</code></strong> must be configured with the 
location(s) to use when resolving properties. One or more locations can be 
given. Specifying multiple locations can be done a couple of ways: using either 
a single comma separated string, or an array of strings.</p><div class="
 code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[pc.setLocation(&quot;com/mycompany/myprop.properties,com/mycompany/other.properties&quot;);
 pc.setLocation(new String[] {&quot;com/mycompany/myprop.properties&quot;, 
&quot;com/mycompany/other.properties&quot;}); ]]></script>
-</div></div><div><p>&#160;</p><p>From<strong> Camel 2.19.0</strong>: you can 
set which location can be discarded if missing by setting&#160; 
<strong><code>optional=true</code></strong>, 
(<strong><code>false</code></strong> by 
default).</p><p>Example:</p></div><div><p>&#160;</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><div><p>From<strong> Camel 2.19.0</strong>: you can set which 
location can be discarded if missing by setting&#160; 
<strong><code>optional=true</code></strong>, 
(<strong><code>false</code></strong> by 
default).</p><p>Example:</p></div><div><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[pc.setLocations(&quot;com/mycompany/override.properties;optional=true,com/mycompany/defaults.properties&quot;);]]></script>
 </div></div><p>&#160;</p></div><h4 
id="UsingPropertyPlaceholder-UsingSystemandEnvironmentVariablesinLocations">Using
 System and Environment Variables in Locations</h4><p><strong>Available as of 
Camel 2.7</strong></p><p>The location now supports using placeholders for JVM 
system properties and OS environments variables.</p><p>Example:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[location=file:${karaf.home}/etc/foo.properties
@@ -341,7 +341,7 @@ assertMockEndpointsSatisfied();
         &lt;/route&gt;
     &lt;/camelContext&gt;
 &lt;/blueprint&gt;]]></script>
-</div></div><p><span style="line-height: 1.42857;"><br 
clear="none"></span></p><p><span style="line-height: 1.42857;">By default Camel 
detects and uses OSGi blueprint property placeholder service. You can disable 
this by setting the attribute </span><strong><code style="line-height: 
1.42857;">useBlueprintPropertyResolver</code></strong><span style="line-height: 
1.42857;"> to false on the </span><strong><code style="line-height: 
1.42857;">&lt;camelContext&gt;</code></strong><span style="line-height: 
1.42857;"> definition.</span></p><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">About placeholder 
syntaxes</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Notice how we can use the Camel 
syntax for placeholders&#160;<code><strong>{{</strong> 
<strong>}}</strong></code> in the Camel route, which will lookup the value from 
OSGi blueprint.<
 br clear="none"> The blueprint syntax for placeholders is 
<strong><code>${}</code></strong>. So outside 
the&#160;<strong><code>&lt;camelContext&gt;</code></strong> you must use 
the&#160;<strong><code>${}</code></strong> syntax. Where as 
inside&#160;<strong><code>&lt;camelContext&gt;</code></strong> you must 
use&#160;<code><strong>{{</strong> <strong>}}</strong></code> syntax. OSGi 
blueprint allows you to configure the syntax, so you can actually align those 
if you want.</p></div></div><p>You can also explicit refer to a specific OSGi 
blueprint property placeholder by its id. For that you need to use the 
Camel's&#160;<strong><code>&lt;propertyPlaceholder&gt;</code></strong> as shown 
in the example below:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><p><span style="line-height: 1.42857;">By default Camel detects 
and uses OSGi blueprint property placeholder service. You can disable this by 
setting the attribute </span><strong><code style="line-height: 
1.42857;">useBlueprintPropertyResolver</code></strong><span style="line-height: 
1.42857;"> to false on the </span><strong><code style="line-height: 
1.42857;">&lt;camelContext&gt;</code></strong><span style="line-height: 
1.42857;"> definition.</span></p><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">About placeholder 
syntaxes</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Notice how we can use the Camel 
syntax for placeholders&#160;<code><strong>{{</strong> 
<strong>}}</strong></code> in the Camel route, which will lookup the value from 
OSGi blueprint.<br clear="none"> The blueprint syntax for placeholders is 
<strong><
 code>${}</code></strong>. So outside 
the&#160;<strong><code>&lt;camelContext&gt;</code></strong> you must use 
the&#160;<strong><code>${}</code></strong> syntax. Where as 
inside&#160;<strong><code>&lt;camelContext&gt;</code></strong> you must 
use&#160;<code><strong>{{</strong> <strong>}}</strong></code> syntax. OSGi 
blueprint allows you to configure the syntax, so you can actually align those 
if you want.</p></div></div><p>You can also explicit refer to a specific OSGi 
blueprint property placeholder by its id. For that you need to use the 
Camel's&#160;<strong><code>&lt;propertyPlaceholder&gt;</code></strong> as shown 
in the example below:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;blueprint 
xmlns=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot;
            xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
            
xmlns:cm=&quot;http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0&quot;
@@ -369,7 +369,7 @@ assertMockEndpointsSatisfied();
         &lt;/route&gt;
     &lt;/camelContext&gt;
 &lt;/blueprint&gt;]]></script>
-</div></div><p>&#160;</p><p>Notice how we use the 
<strong><code>blueprint</code></strong> scheme to refer to the OSGi blueprint 
placeholder by its id. This allows you to mix and match, for example you can 
also have additional schemes in the location. For example to load a file from 
the classpath you can do:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Notice how we use the <strong><code>blueprint</code></strong> 
scheme to refer to the OSGi blueprint placeholder by its id. This allows you to 
mix and match, for example you can also have additional schemes in the 
location. For example to load a file from the classpath you can do:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[location=&quot;blueprint:myblueprint.placeholder,classpath:myproperties.properties&quot;
 ]]></script>
 </div></div><p>Each location is separated by comma.</p><h4 
id="UsingPropertyPlaceholder-OverridingBlueprintPropertyPlaceholdersOutsideCamelContext">Overriding
 Blueprint Property Placeholders Outside CamelContext</h4><p><strong>Available 
as of Camel 2.10.4</strong></p><p>When using Blueprint property placeholder in 
the Blueprint XML file, you can declare the properties directly in the XML file 
as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
@@ -397,7 +397,7 @@ assertMockEndpointsSatisfied();
 
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>&#160;<p>Notice that we have 
a&#160;<strong><code>&lt;bean&gt;</code></strong> which refers to one of the 
properties. And in the Camel route we refer to the other using 
the&#160;<strong><code>{{ }}</code></strong> notation.</p><p>Now if you want to 
override these Blueprint properties from an unit test, you can do this as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div>Notice that we have 
a&#160;<strong><code>&lt;bean&gt;</code></strong> which refers to one of the 
properties. And in the Camel route we refer to the other using 
the&#160;<strong><code>{{ }}</code></strong> notation.<p>Now if you want to 
override these Blueprint properties from an unit test, you can do this as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 @Override
 protected String useOverridePropertiesWithConfigAdmin(Dictionary props) {
@@ -408,7 +408,7 @@ protected String useOverridePropertiesWi
     return &quot;my-placeholders&quot;;
 }
 ]]></script>
-</div></div>&#160;<p>To do this we override and implement the 
<strong><code>useOverridePropertiesWithConfigAdmin</code></strong> method. We 
can then put the properties we want to override on the given props parameter. 
And the return value <em>must</em> be the persistence-id of 
the&#160;<strong><code>&lt;cm:property-placeholder&gt;</code></strong> tag, 
which you define in the blueprint XML file.</p><h4 
id="UsingPropertyPlaceholder-Usinga.cfgor.propertiesFileforBlueprintPropertyPlaceholders">Using
 a <code>.cfg</code> or&#160;<code>.properties</code> File for Blueprint 
Property Placeholders</h4><p><strong>Available as of Camel 
2.10.4</strong></p><p>When using Blueprint property placeholder in the 
Blueprint XML file, you can declare the properties in a .properties 
or&#160;<strong><code>.cfg</code></strong> file. If you use Apache 
ServiceMix/Karaf then this container has a convention that it loads the 
properties from a file in the etc directory with the naming 
<strong><code>etc/pid.cfg</
 code></strong>, where&#160;<strong><code>pid</code></strong> is the 
persistence-id.</p><p>For example in the blueprint XML file we have the 
<strong><code>persistence-id="stuff"</code></strong>, which mean it will load 
the configuration file as <strong><code>etc/stuff.cfg</code></strong>.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div>To do this we override and implement the 
<strong><code>useOverridePropertiesWithConfigAdmin</code></strong> method. We 
can then put the properties we want to override on the given props parameter. 
And the return value <em>must</em> be the persistence-id of 
the&#160;<strong><code>&lt;cm:property-placeholder&gt;</code></strong> tag, 
which you define in the blueprint XML file.<h4 
id="UsingPropertyPlaceholder-Usinga.cfgor.propertiesFileForBlueprintPropertyPlaceholders">Using
 a <code>.cfg</code> or&#160;<code>.properties</code> File For Blueprint 
Property Placeholders</h4><p><strong>Available as of Camel 
2.10.4</strong></p><p>When using Blueprint property placeholder in the 
Blueprint XML file, you can declare the properties in a .properties 
or&#160;<strong><code>.cfg</code></strong> file. If you use Apache 
ServiceMix/Karaf then this container has a convention that it loads the 
properties from a file in the etc directory with the naming 
<strong><code>etc/pid.cfg</code></strong
 >, where&#160;<strong><code>pid</code></strong> is the 
 >persistence-id.</p><p>For example in the blueprint XML file we have the 
 ><strong><code>persistence-id="stuff"</code></strong>, which mean it will load 
 >the configuration file as 
 ><strong><code>etc/stuff.cfg</code></strong>.</p><div class="code panel pdl" 
 >style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;!-- blueprint property placeholders, that will use etc/stuff.cfg as the 
properties file --&gt;
 &lt;cm:property-placeholder persistent-id=&quot;stuff&quot; 
update-strategy=&quot;reload&quot;/&gt;
@@ -428,7 +428,7 @@ protected String useOverridePropertiesWi
 
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>&#160;<p>Now if you want to unit test this blueprint XML file, 
then you can override the 
<strong><code>loadConfigAdminConfigurationFile</code></strong> and tell Camel 
which file to load as shown below:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Now if you want to unit test this blueprint XML file, then you can 
override the <strong><code>loadConfigAdminConfigurationFile</code></strong> and 
tell Camel which file to load as shown below:<div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 @Override
 protected String[] loadConfigAdminConfigurationFile() {
@@ -437,7 +437,7 @@ protected String[] loadConfigAdminConfig
     return new String[]{&quot;src/test/resources/etc/stuff.cfg&quot;, 
&quot;stuff&quot;};
 }
 ]]></script>
-</div></div>&#160;<p>Notice that this method requires to return 
a&#160;<strong><code>String[]</code></strong> with 2 values. The 1st value is 
the path for the configuration file to load. The second value is the 
persistence-id of 
the&#160;<strong><code>&lt;cm:property-placeholder&gt;</code></strong> 
tag.</p><p>The&#160;<strong><code>stuff.cfg</code></strong> file is just a 
plain properties file with the property placeholders such as:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div>Notice that this method requires to return 
a&#160;<strong><code>String[]</code></strong> with 2 values. The 1st value is 
the path for the configuration file to load. The second value is the 
persistence-id of 
the&#160;<strong><code>&lt;cm:property-placeholder&gt;</code></strong> 
tag.<p>The&#160;<strong><code>stuff.cfg</code></strong> file is just a plain 
properties file with the property placeholders such as:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[## this is a comment
 greeting=Bye
 ]]></script>
@@ -479,7 +479,7 @@ greeting=Bye
 
 &lt;/blueprint&gt;
 ]]></script>
-</div></div>&#160;<p>And in the unit test class we do as follows:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div>And in the unit test class we do as follows:<div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 /**
  * This example will load a Blueprint .cfg file (which will initialize 
configadmin), and also override its property
@@ -524,7 +524,7 @@ public class ConfigAdminLoadConfiguratio
 
 }
 ]]></script>
-</div></div>&#160;<p>And the <strong><code>etc/stuff.cfg</code></strong> 
configuration file contains:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>And the <strong><code>etc/stuff.cfg</code></strong> configuration 
file contains:<div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[greeting=Bye
 echo=Yay
 destination=mock:result
@@ -539,7 +539,7 @@ destination=mock:result
 &lt;/bean&gt;
 
 ]]></script>
-</div></div>&#160;<p>You <strong>must not</strong> use the 
spring&#160;<strong><code>&lt;context:property-placeholder&gt;</code></strong> 
namespace at the same time; this is not possible.</p><p>After declaring this 
bean, you can define property placeholders using both the Spring style, and the 
Camel style within the&#160;<strong><code>&lt;camelContext&gt;</code></strong> 
tag as shown below:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Using bridge property placeholders</b></div><div class="codeContent 
panelContent pdl">
+</div></div>You <strong>must not</strong> use the 
spring&#160;<strong><code>&lt;context:property-placeholder&gt;</code></strong> 
namespace at the same time; this is not possible.<p>After declaring this bean, 
you can define property placeholders using both the Spring style, and the Camel 
style within the&#160;<strong><code>&lt;camelContext&gt;</code></strong> tag as 
shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Using 
bridge property placeholders</b></div><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 
 &lt;!-- a bean that uses Spring property placeholder --&gt;
@@ -558,7 +558,7 @@ destination=mock:result
 &lt;/camelContext&gt;
 
 ]]></script>
-</div></div>&#160;<p>Notice how the hello bean is using pure Spring property 
placeholders using the&#160;<strong><code>${}</code></strong> notation. And in 
the Camel routes we use the Camel placeholder notation with <strong><code>{{ 
}}</code></strong>.</p><h4 
id="UsingPropertyPlaceholder-ClashingSpringPropertyPlaceholderswithCamelsLanguage">Clashing
 Spring Property Placeholders with Camels <a shape="rect" 
href="simple.html">Simple</a> Language</h4><p>Take notice when using Spring 
bridging placeholder then the spring&#160;<strong><code>${}</code></strong> 
syntax clashes with the <a shape="rect" href="simple.html">Simple</a> in Camel, 
and therefore take care.</p><p>Example:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Notice how the hello bean is using pure Spring property 
placeholders using the&#160;<strong><code>${}</code></strong> notation. And in 
the Camel routes we use the Camel placeholder notation with <strong><code>{{ 
}}</code></strong>.<h4 
id="UsingPropertyPlaceholder-ClashingSpringPropertyPlaceholderswithCamelsLanguage">Clashing
 Spring Property Placeholders with Camels <a shape="rect" 
href="simple.html">Simple</a> Language</h4><p>Take notice when using Spring 
bridging placeholder then the spring&#160;<strong><code>${}</code></strong> 
syntax clashes with the <a shape="rect" href="simple.html">Simple</a> in Camel, 
and therefore take care.</p><p>Example:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;setHeader 
headerName=&quot;Exchange.FILE_NAME&quot;&gt;
   &lt;simple&gt;{{file.rootdir}}/${in.header.CamelFileName}&lt;/simple&gt;
 &lt;/setHeader&gt;
@@ -579,7 +579,7 @@ protected Properties useOverrideProperti
     return extra;
 }
 ]]></script>
-</div></div>&#160;<p>This can be done from any of the Camel Test kits, such as 
<strong><code>camel-test</code></strong>, 
<strong><code>camel-test-spring</code></strong> and 
<strong><code>camel-test-blueprint</code></strong>.</p><p>The 
<strong><code>ignoreMissingLocationWithPropertiesComponent</code></strong> can 
be used to instruct Camel to ignore any locations which was not discoverable. 
For example if you run the unit test, in an environment that does not have 
access to the location of the properties.</p><h3 
id="UsingPropertyPlaceholder-Using@PropertyInject">Using&#160;<code>@PropertyInject</code></h3><p><strong>Available
 as of Camel 2.12</strong></p><p>Camel allows to inject property placeholders 
in POJOs using the&#160;<strong><code>@PropertyInject</code></strong> 
annotation which can be set on fields and setter methods. For example you can 
use that with <strong><code>RouteBuilder</code></strong> classes, such as shown 
below:</p><div class="code panel pdl" style="border-width: 1
 px;"><div class="codeContent panelContent pdl">
+</div></div>This can be done from any of the Camel Test kits, such as 
<strong><code>camel-test</code></strong>, 
<strong><code>camel-test-spring</code></strong> and 
<strong><code>camel-test-blueprint</code></strong>.<p>The 
<strong><code>ignoreMissingLocationWithPropertiesComponent</code></strong> can 
be used to instruct Camel to ignore any locations which was not discoverable. 
For example if you run the unit test, in an environment that does not have 
access to the location of the properties.</p><h3 
id="UsingPropertyPlaceholder-Using@PropertyInject">Using&#160;<code>@PropertyInject</code></h3><p><strong>Available
 as of Camel 2.12</strong></p><p>Camel allows to inject property placeholders 
in POJOs using the&#160;<strong><code>@PropertyInject</code></strong> 
annotation which can be set on fields and setter methods. For example you can 
use that with <strong><code>RouteBuilder</code></strong> classes, such as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div cla
 ss="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[public class MyRouteBuilder extends 
RouteBuilder {
 
     @PropertyInject(&quot;hello&quot;)
@@ -617,17 +617,17 @@ private int timeout;
     &lt;to uri=&quot;{{sys:MyJvmPropertyName:log:bar}}&quot;/&gt;
   &lt;/route&gt;
 &lt;/camelContext&gt;]]></script>
-</div></div><p>&#160;</p><p>The service function is for looking up a service 
which is defined using OS environment variables using the service naming idiom, 
to refer to a service location using&#160;<strong><code>hostname : 
port</code></strong></p><ul><li><em><code>NAME</code></em><strong><code>_SERVICE_HOST</code></strong></li><li><em><code>NAME</code></em><strong><code>_SERVICE_PORT</code></strong></li></ul><p>in
 other words the service uses&#160;<strong><code>_SERVICE_HOST</code></strong> 
and&#160;<strong><code>_SERVICE_PORT</code></strong> as prefix. So if the 
service is named <strong><code>FOO</code></strong>, then the OS environment 
variables should be set as</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The service function is for looking up a service which is 
defined using OS environment variables using the service naming idiom, to refer 
to a service location using&#160;<strong><code>hostname : 
port</code></strong></p><ul><li><em><code>NAME</code></em><strong><code>_SERVICE_HOST</code></strong></li><li><em><code>NAME</code></em><strong><code>_SERVICE_PORT</code></strong></li></ul><p>in
 other words the service uses&#160;<strong><code>_SERVICE_HOST</code></strong> 
and&#160;<strong><code>_SERVICE_PORT</code></strong> as prefix. So if the 
service is named <strong><code>FOO</code></strong>, then the OS environment 
variables should be set as</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[export $FOO_SERVICE_HOST=myserver
 export $FOO_SERVICE_PORT=8888]]></script>
-</div></div><p>&#160;</p><p>For example if 
the&#160;<strong><code>FOO</code></strong> service a remote HTTP service, then 
we can refer to the service in the Camel endpoint URI, and use the&#160;<a 
shape="rect" href="http.html">HTTP</a>&#160;component to make the HTTP 
call:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>For example if the&#160;<strong><code>FOO</code></strong> 
service a remote HTTP service, then we can refer to the service in the Camel 
endpoint URI, and use the&#160;<a shape="rect" 
href="http.html">HTTP</a>&#160;component to make the HTTP call:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
   &lt;route&gt;
     &lt;from uri=&quot;direct:start&quot;/&gt;
     &lt;to uri=&quot;http://{{service:FOO}}/myapp&quot;/&gt;
   &lt;/route&gt;
 &lt;/camelContext&gt;]]></script>
-</div></div><p>&#160;</p><p>And we can use default values if the service has 
not been defined, for example to call a service on localhost, maybe for unit 
testing etc:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>And we can use default values if the service has not been 
defined, for example to call a service on localhost, maybe for unit testing 
etc:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
   &lt;route&gt;
     &lt;from uri=&quot;direct:start&quot;/&gt;


Reply via email to