Modified: websites/production/camel/content/using-propertyplaceholder.html
==============================================================================
--- websites/production/camel/content/using-propertyplaceholder.html (original)
+++ websites/production/camel/content/using-propertyplaceholder.html Thu Sep  8 
16:19:03 2016
@@ -86,62 +86,66 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 
id="UsingPropertyPlaceholder-UsingPropertyPlaceholder">Using 
PropertyPlaceholder</h2><p><strong>Available as of Camel 
2.3</strong></p><p>Camel now provides a new <code>PropertiesComponent</code> in 
<strong>camel-core</strong> which allows you to use property placeholders when 
defining Camel <a shape="rect" href="endpoint.html">Endpoint</a> URIs. <br 
clear="none"> This works much like you would do if using Spring's 
<code>&lt;property-placeholder&gt;</code> tag. However Spring have a limitation 
which prevents 3rd party frameworks to leverage Spring property placeholders to 
the fullest. See more at <a shape="rect" 
href="how-do-i-use-spring-property-placeholder-with-camel-xml.html">How do I 
use Spring Property Placeholder with Camel XML</a>.</p><div 
class="confluence-information-macro confluence-information-macro-tip"><p 
class="title">Bridging Spring and Camel property placeholders</p><span 
class="aui-icon aui-icon-small aui-iconfont-approve con
 fluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>From Camel 2.10 onwards, you can 
bridge the Spring property placeholder with Camel, see further below for more 
details.</p></div></div><p>The property placeholder is generally in use when 
doing:</p><ul class="alternate"><li>lookup or creating endpoints</li><li>lookup 
of beans in the <a shape="rect" 
href="registry.html">Registry</a></li><li>additional supported in Spring XML 
(see below in examples)</li><li>using Blueprint PropertyPlaceholder with Camel 
<a shape="rect" href="properties.html">Properties</a> component</li><li>using 
<code>@PropertyInject</code> to inject a property in a 
POJO</li><li><strong>Camel 2.14.1</strong> Using default value if a property 
does not exists</li><li><strong>Camel 2.14.1</strong> Include out of the box 
functions, to lookup property values from OS environment variables, JVM system 
properties, or the service idiom.</li><li><strong>Camel 2.14.1</strong> Using 
custom f
 unctions, which can be plugged into the property component.</li></ul><h3 
id="UsingPropertyPlaceholder-Syntax">Syntax</h3><p>The syntax to use Camel's 
property placeholder is to use {{<code>key</code>}} for example 
{{<code>file.uri</code>}} where <code>file.uri</code> is the property key.<br 
clear="none"> You can use property placeholders in parts of the endpoint URI's 
which for example you can use placeholders for parameters in the 
URIs.</p><p>From&#160;<strong>Camel 2.14.1</strong> onwards you can specify a 
default value to use if a property with the key does not exists, 
eg&#160;<code>file.url:/some/path</code> where the default value is the text 
after the colon (eg /some/path).</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>Do not use colon in the property 
key. The colon is used as a separator toke
 n when you are providing a default value, which is supported from 
<strong>Camel 2.14.1</strong> onwards.</p></div></div><h3 
id="UsingPropertyPlaceholder-PropertyResolver">PropertyResolver</h3><p>Camel 
provides a pluggable mechanism which allows 3rd part to provide their own 
resolver to lookup properties. Camel provides a default implementation 
<code>org.apache.camel.component.properties.DefaultPropertiesResolver</code> 
which is capable of loading properties from the file system, classpath or <a 
shape="rect" href="registry.html">Registry</a>. You can prefix the locations 
with either:</p><ul class="alternate"><li><code>ref:</code> <strong>Camel 
2.4:</strong> to lookup in the <a shape="rect" 
href="registry.html">Registry</a></li><li><code>file:</code> to load the from 
file system</li><li><code>classpath:</code> to load from classpath (this is 
also the default if no prefix is provided)</li><li><code>blueprint:</code> 
<strong>Camel 2.7:</strong> to use a specific OSGi blueprint placehold
 er service</li></ul><h3 
id="UsingPropertyPlaceholder-Defininglocation">Defining location</h3><p>The 
<code>PropertiesResolver</code> need to know a location(s) where to resolve the 
properties. You can define 1 to many locations. If you define the location in a 
single String property you can separate multiple locations with comma such 
as:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 
id="UsingPropertyPlaceholder-UsingPropertyPlaceholder">Using&#160;<code>PropertyPlaceholder</code></h2><p><strong>Available
 as of Camel 2.3</strong></p><p>Camel now provides a new 
<strong><code>PropertiesComponent</code></strong> in 
<strong>camel-core</strong> which allows you to use property placeholders when 
defining Camel <a shape="rect" href="endpoint.html">Endpoint</a> URIs. This 
works much like you would do if using Spring's 
<strong><code>&lt;property-placeholder&gt;</code></strong> tag. However Spring 
have a limitation which prevents 3rd party frameworks to leverage Spring 
property placeholders to the fullest.</p><p>For more details see: <a 
shape="rect" 
href="how-do-i-use-spring-property-placeholder-with-camel-xml.html">How do I 
use Spring Property Placeholder with Camel XML</a>.</p><div 
class="confluence-information-macro confluence-information-macro-tip"><p 
class="title">Bridging Spring and Camel property placeholders</p><span class
 ="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>From <strong>Camel 2.10</strong>: 
Spring's property placeholder can be bridged with Camel's. See below for more 
details.</p></div></div><p>The property placeholder is generally in use when 
doing:</p><ul class="alternate"><li>lookup or creating 
endpoints.</li><li>lookup of beans in the <a shape="rect" 
href="registry.html">Registry.</a></li><li>additional supported in Spring XML 
(see below in examples).</li><li>using 
Blueprint&#160;<strong><code>PropertyPlaceholder</code></strong> with Camel <a 
shape="rect" href="properties.html">Properties</a> component.</li><li>using 
<strong><code>@PropertyInject</code></strong> to inject a property in a 
POJO.</li><li><strong>Camel 2.14.1</strong> Using default value if a property 
does not exists.</li><li><strong>Camel 2.14.1</strong> Include out of the box 
functions, to lookup property values from OS environment
  variables, JVM system properties, or the service idiom.</li><li><strong>Camel 
2.14.1</strong> Using custom functions, which can be plugged into the property 
component.</li></ul><h3 id="UsingPropertyPlaceholder-Syntax">Syntax</h3><p>The 
syntax to use Camel's property placeholder is to use 
<strong>{{<code>key</code>}}</strong> for example 
<strong>{{<code>file.uri</code>}}</strong> where 
<strong><code>file.uri</code></strong> is the property key. You can use 
property placeholders in parts of the endpoint URI's which for example you can 
use placeholders for parameters in the URIs.</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 
au
 i-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">Using&#160;<code>PropertyResolver</code></h3><p>Camel
 provides a pluggable mechanism which allows 3rd part to provide their own 
resolver to lookup properties. 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>. You can prefix the locations 
with either:</p><ul class="alternate"><li><strong><code>ref:</code> Camel 
2.4:</strong> to lookup in the <a shape="rect" 
href="registry.html">Registry.</a></li><li><strong><code>file:</code></strong> 
to loa
 d the from file system.</li><li><strong><code>classpath:</code></strong> to 
load from classpath (this is also the default if no prefix is 
provided).</li><li><strong><code>blueprint:</code> Camel 2.7:</strong> to use a 
specific OSGi blueprint placeholder service.</li></ul><h3 
id="UsingPropertyPlaceholder-DefiningLocation">Defining Location</h3><p>The 
<strong><code>PropertiesResolver</code></strong> need to know a location(s) 
where to resolve the properties. You can define 1 to many locations. If you 
define the location in a single String property you can separate multiple 
locations with comma 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[pc.setLocation(&quot;com/mycompany/myprop.properties,com/mycompany/other.properties&quot;);
 ]]></script>
-</div></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>For example:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></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
 ]]></script>
-</div></div><p>In the location above we defined a location using the file 
scheme using the JVM system property with key <code>karaf.home</code>.</p><p>To 
use an OS environment variable instead you would have to prefix with 
env:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>In the location above we defined a location using the file 
scheme using the JVM system property with key 
<strong><code>karaf.home</code></strong>.</p><p>To use an OS environment 
variable instead you would have to prefix with 
<strong><code>env</code></strong>:</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:${env:APP_HOME}/etc/foo.properties
 ]]></script>
-</div></div><p>Where <code>APP_HOME</code> is an OS environment.</p><p>You can 
have multiple placeholders in the same location, such as:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Where <strong><code>APP_HOME</code></strong> is an OS 
environment.</p><p>You can have multiple placeholders in the same location, 
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[location=file:${env:APP_HOME}/etc/${prop.name}.properties
 ]]></script>
-</div></div><h4 
id="UsingPropertyPlaceholder-Usingsystemandenvironmentvariablestoconfigurepropertyprefixesandsuffixes">Using
 system and environment variables to configure property prefixes and 
suffixes</h4><p><strong>Available as of Camel 2.12.5, 2.13.3, 
2.14.0</strong></p><p><code>propertyPrefix</code>, <code>propertySuffix</code> 
configuration properties support using placeholders for JVM system properties 
and OS environments variables.</p><p>For example. 
if&#160;<code>PropertiesComponent</code> is configured with the following 
properties file:</p><div class="preformatted panel" style="border-width: 
1px;"><div class="preformattedContent panelContent">
+</div></div><h4 
id="UsingPropertyPlaceholder-UsingSystemandEnvironmentVariablestoConfigurePropertyPrefixesandSuffixes">Using
 System and Environment Variables to Configure Property Prefixes and 
Suffixes</h4><p><strong>Available as of Camel 2.12.5, 2.13.3, 
2.14.0</strong></p><p><strong><code>propertyPrefix</code></strong>, 
<strong><code>propertySuffix</code></strong> configuration properties support 
using placeholders for JVM system properties and OS environments 
variables.</p><p>For example, 
if&#160;<strong><code>PropertiesComponent</code></strong> is configured with 
the following properties file:</p><div class="preformatted panel" 
style="border-width: 1px;"><div class="preformattedContent panelContent">
 <pre>dev.endpoint = result1
 test.endpoint = result2</pre>
 </div></div><p>Then with the following route definition:</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[PropertiesComponent pc = 
context.getComponent(&quot;properties&quot;, PropertiesComponent.class);
 pc.setPropertyPrefix(&quot;${stage}.&quot;);
+
 // ...
 context.addRoutes(new RouteBuilder() {
     @Override
     public void configure() throws Exception {
-        
from(&quot;direct:start&quot;).to(&quot;properties:mock:{{endpoint}}&quot;);
+        from(&quot;direct:start&quot;)
+          .to(&quot;properties:mock:{{endpoint}}&quot;);
     }
 });]]></script>
-</div></div><p>it is possible to change the target endpoint by changing system 
property&#160;<code>stage</code> either to&#160;<code>dev</code> (the message 
will be routed to&#160;<code>mock:result1</code>) or&#160;<code>test</code> 
(the message will be routed to&#160;<code>mock:result2</code>).</p><h3 
id="UsingPropertyPlaceholder-ConfiguringinJavaDSL">Configuring in Java 
DSL</h3><p>You have to create and register the <code>PropertiesComponent</code> 
under the name <code>properties</code> such as:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>it is possible to change the target endpoint by changing system 
property&#160;<strong><code>stage</code></strong> either 
to&#160;<strong><code>dev</code></strong> (the message will be routed 
to&#160;<strong><code>mock:result1</code></strong>) 
or&#160;<strong><code>test</code></strong> (the message will be routed 
to&#160;<strong><code>mock:result2</code></strong>).</p><h3 
id="UsingPropertyPlaceholder-ConfiguringinJavaDSL">Configuring in Java 
DSL</h3><p>You have to create and register the 
<strong><code>PropertiesComponent</code></strong> under the name 
<strong><code>properties</code></strong> 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[PropertiesComponent pc = new 
PropertiesComponent();
 pc.setLocation(&quot;classpath:com/mycompany/myprop.properties&quot;);
 context.addComponent(&quot;properties&quot;, pc);
 ]]></script>
-</div></div><h3 
id="UsingPropertyPlaceholder-ConfiguringinSpringXML">Configuring in Spring 
XML</h3><p>Spring XML offers two variations to configure. You can define a 
spring bean as a <code>PropertiesComponent</code> which resembles the way done 
in Java DSL. Or you can use the <code>&lt;propertyPlaceholder&gt;</code> 
tag.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><h3 
id="UsingPropertyPlaceholder-ConfiguringinSpringXML">Configuring in Spring 
XML</h3><p>Spring XML offers two variations to configure. You can define a 
spring bean as a <strong><code>PropertiesComponent</code></strong> which 
resembles the way done in Java DSL. Or you can use the 
<strong><code>&lt;propertyPlaceholder&gt;</code></strong> tag.</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;bean id=&quot;properties&quot; 
class=&quot;org.apache.camel.component.properties.PropertiesComponent&quot;&gt;
     &lt;property name=&quot;location&quot; 
value=&quot;classpath:com/mycompany/myprop.properties&quot;/&gt;
 &lt;/bean&gt;
 ]]></script>
-</div></div><p>Using the <code>&lt;propertyPlaceholder&gt;</code> tag makes 
the configuration a bit more fresh such as:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Using the 
<strong><code>&lt;propertyPlaceholder&gt;</code></strong> tag makes the 
configuration a bit more fresh such as:</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 ...&gt;
    &lt;propertyPlaceholder id=&quot;properties&quot; 
location=&quot;com/mycompany/myprop.properties&quot;/&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div><div class="confluence-information-macro 
confluence-information-macro-tip"><p class="title">Specifying the cache option 
inside XML</p><span class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Camel 2.10 onwards supports 
specifying a value for the cache option both inside the Spring as well as the 
Blueprint XML.</p></div></div><h3 
id="UsingPropertyPlaceholder-UsingaPropertiesfromthe">Using a Properties from 
the <a shape="rect" href="registry.html">Registry</a></h3><p><strong>Available 
as of Camel 2.4</strong><br clear="none"> For example in OSGi you may want to 
expose a service which returns the properties as a 
<code>java.util.Properties</code> object.</p><p>Then you could setup the <a 
shape="rect" href="properties.html">Properties</a> component as 
follows:</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;propertyPlaceholder 
id=&quot;properties&quot; location=&quot;ref:myProperties&quot;/&gt;
+</div></div><div class="confluence-information-macro 
confluence-information-macro-tip"><p class="title">Specifying the cache option 
in XML</p><span class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>From <strong>Camel 2.10</strong>: 
Camel supports specifying a value for 
the&#160;<strong><code>cache</code></strong> option both inside the Spring as 
well as the Blueprint XML.</p></div></div><h3 
id="UsingPropertyPlaceholder-UsingaPropertiesfromthe">Using a Properties from 
the <a shape="rect" href="registry.html">Registry</a></h3><p><strong>Available 
as of Camel 2.4</strong><br clear="none"> For example in OSGi you may want to 
expose a service which returns the properties as a 
<strong><code>java.util.Properties</code></strong> object.</p><p>Then you could 
setup the <a shape="rect" href="properties.html">Properties</a> component as 
follows:</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;propertyPlaceholder 
id=&quot;properties&quot; location=&quot;ref:myProperties&quot;/&gt;
 ]]></script>
-</div></div><p>Where <code>myProperties</code> is the id to use for lookup in 
the OSGi registry. Notice we use the <code>ref:</code> prefix to tell Camel 
that it should lookup the properties for the <a shape="rect" 
href="registry.html">Registry</a>.</p><h3 
id="UsingPropertyPlaceholder-Examplesusingpropertiescomponent">Examples using 
properties component</h3><p>When using property placeholders in the endpoint 
URIs you can either use the <code>properties:</code> component or define the 
placeholders directly in the URI. We will show example of both cases, starting 
with the former.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>Where <strong><code>myProperties</code></strong> is the id to 
use for lookup in the OSGi registry. Notice we use the 
<strong><code>ref:</code></strong> prefix to tell Camel that it should lookup 
the properties for the <a shape="rect" 
href="registry.html">Registry</a>.</p><h3 
id="UsingPropertyPlaceholder-ExamplesUsingPropertiesComponent">Examples Using 
Properties Component</h3><p>When using property placeholders in the endpoint 
URIs you can either use the <strong><code>properties:</code></strong> component 
or define the placeholders directly in the URI. We will show example of both 
cases, starting with the former.</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[// properties
 cool.end=mock:result
 
 // route
-from(&quot;direct:start&quot;).to(&quot;properties:{{cool.end}}&quot;);
+from(&quot;direct:start&quot;)
+  .to(&quot;properties:{{cool.end}}&quot;);
 ]]></script>
-</div></div><p>You can also use placeholders as a part of the endpoint 
uri:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>You can also use placeholders as a part of the endpoint 
URI:</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[// properties
 cool.foo=result
 
 // route
-from(&quot;direct:start&quot;).to(&quot;properties:mock:{{cool.foo}}&quot;);
+from(&quot;direct:start&quot;)
+  .to(&quot;properties:mock:{{cool.foo}}&quot;);
 ]]></script>
 </div></div><p>In the example above the to endpoint will be resolved to 
<code>mock:result</code>.</p><p>You can also have properties with refer to each 
other 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[// properties
@@ -149,17 +153,20 @@ cool.foo=result
 cool.concat=mock:{{cool.foo}}
 
 // route
-from(&quot;direct:start&quot;).to(&quot;properties:mock:{{cool.concat}}&quot;);
+from(&quot;direct:start&quot;)
+  .to(&quot;properties:mock:{{cool.concat}}&quot;);
 ]]></script>
-</div></div><p>Notice how <code>cool.concat</code> refer to another 
property.</p><p>The <code>properties:</code> component also offers you to 
override and provide a location in the given uri using the 
<code>locations</code> option:</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[   
from(&quot;direct:start&quot;).to(&quot;properties:bar.end?locations=com/mycompany/bar.properties&quot;);
+</div></div><p>Notice how <strong><code>cool.concat</code></strong> refer to 
another property.</p><p>The <strong><code>properties:</code></strong> component 
also offers you to override and provide a location in the given URI using the 
<strong><code>locations</code></strong> option:</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[from(&quot;direct:start&quot;)
+  .to(&quot;properties:bar.end?locations=com/mycompany/bar.properties&quot;);
 ]]></script>
-</div></div><h3 id="UsingPropertyPlaceholder-Examples">Examples</h3><p>You can 
also use property placeholders directly in the endpoint uris without having to 
use <code>properties:</code>.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="UsingPropertyPlaceholder-Examples">Examples</h3><p>You can 
also use property placeholders directly in the endpoint URIs without having to 
use <strong><code>properties:</code></strong>.</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[// properties
 cool.foo=result
 
 // route
-from(&quot;direct:start&quot;).to(&quot;mock:{{cool.foo}}&quot;);
+from(&quot;direct:start&quot;)
+  .to(&quot;mock:{{cool.foo}}&quot;);
 ]]></script>
 </div></div><p>And you can use them in multiple wherever you want 
them:</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[// properties
@@ -191,7 +198,7 @@ bar.quote=Beer tastes good
 from(&quot;direct:start&quot;)
     .transform().simple(&quot;Hi ${body}. 
${properties:com/mycompany/bar.properties:bar.quote}.&quot;);
 ]]></script>
-</div></div><h3 
id="UsingPropertyPlaceholder-AdditionalpropertyplaceholdersupportedinSpringXML">Additional
 property placeholder supported in Spring XML</h3><p>The property placeholders 
is also supported in many of the Camel Spring XML tags such as 
<code>&lt;package&gt;, &lt;packageScan&gt;, &lt;contextScan&gt;, 
&lt;jmxAgent&gt;, &lt;endpoint&gt;, &lt;routeBuilder&gt;, &lt;proxy&gt;</code> 
and the others.</p><p>The example below has property placeholder in the 
&lt;jmxAgent&gt; tag:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 
id="UsingPropertyPlaceholder-AdditionalPropertyPlaceholderSupportinSpringXML">Additional
 Property Placeholder Support in Spring XML</h3><p>The property placeholders is 
also supported in many of the Camel Spring XML tags such as 
<code><strong>&lt;package&gt;</strong>, <strong>&lt;packageScan&gt;</strong>, 
<strong>&lt;contextScan&gt;</strong>, <strong>&lt;jmxAgent&gt;</strong>, 
<strong>&lt;endpoint&gt;</strong>, <strong>&lt;routeBuilder&gt;</strong>, 
<strong>&lt;proxy&gt;</strong></code> and the others.</p><p>The example below 
has property placeholder in 
the&#160;<strong><code>&lt;jmxAgent&gt;</code></strong> tag:</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/spring&quot;&gt;
     &lt;propertyPlaceholder id=&quot;properties&quot; 
location=&quot;org/apache/camel/spring/jmx.properties&quot;/&gt;
 
@@ -206,9 +213,8 @@ from(&quot;direct:start&quot;)
         &lt;from uri=&quot;seda:start&quot;/&gt;
         &lt;to uri=&quot;mock:result&quot;/&gt;
     &lt;/route&gt;
-
 &lt;/camelContext&gt;]]></script>
-</div></div><p>You can also define property placeholders in the various 
attributes on the &lt;camelContext&gt; tag such as <code>trace</code> as shown 
here:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>You can also define property placeholders in the various 
attributes on the&#160;<strong><code>&lt;camelContext&gt;</code></strong> tag 
such as <strong><code>trace</code></strong> as shown here:</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 
trace=&quot;{{foo.trace}}&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
     &lt;propertyPlaceholder id=&quot;properties&quot; 
location=&quot;org/apache/camel/spring/processor/myprop.properties&quot;/&gt;
 
@@ -222,7 +228,7 @@ from(&quot;direct:start&quot;)
         &lt;to uri=&quot;mock:result&quot;/&gt;
     &lt;/route&gt;
 &lt;/camelContext&gt;]]></script>
-</div></div><h3 
id="UsingPropertyPlaceholder-OverridingapropertysettingusingaJVMSystemProperty">Overriding
 a property setting using a JVM System Property</h3><p><strong>Available as of 
Camel 2.5</strong><br clear="none"> It is possible to override a property value 
at runtime using a JVM System property without the need to restart the 
application to pick up the change. This may also be accomplished from the 
command line by creating a JVM System property of the same name as the property 
it replaces with a new value. An example of this is given below</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><h3 
id="UsingPropertyPlaceholder-OverridingaPropertySettingUsingaJVMSystemProperty">Overriding
 a Property Setting Using a JVM System Property</h3><p><strong>Available as of 
Camel 2.5</strong><br clear="none"> It is possible to override a property value 
at runtime using a JVM System property without the need to restart the 
application to pick up the change. This may also be accomplished from the 
command line by creating a JVM System property of the same name as the property 
it replaces with a new value.</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[PropertiesComponent pc = 
context.getComponent(&quot;properties&quot;, PropertiesComponent.class);
 pc.setCache(false);
         
@@ -248,7 +254,7 @@ System.clearProperty(&quot;cool.result&q
         
 assertMockEndpointsSatisfied();
 ]]></script>
-</div></div><h3 
id="UsingPropertyPlaceholder-UsingpropertyplaceholdersforanykindofattributeintheXMLDSL">Using
 property placeholders for any kind of attribute in the XML 
DSL</h3><p><strong>Available as of Camel 2.7</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>If you use OSGi Blueprint then 
this only works from <strong>2.11.1</strong> or <strong>2.10.5</strong> 
onwards.</p></div></div><p>Previously it was only the <code>xs:string</code> 
type attributes in the XML DSL that support placeholders. For example often a 
timeout attribute would be a <code>xs:int</code> type and thus you cannot set a 
string value as the placeholder key. This is now possible from Camel 2.7 
onwards using a special placeholder namespace.</p><p>In the example below we 
use the <code>prop</code> prefix for the namespace <c
 ode><a shape="rect" class="external-link" 
href="http://camel.apache.org/schema/placeholder";>http://camel.apache.org/schema/placeholder</a></code>
 by which we can use the <code>prop</code> prefix in the attributes in the XML 
DSLs. Notice how we use that in the <a shape="rect" 
href="multicast.html">Multicast</a> to indicate that the option 
<code>stopOnException</code> should be the value of the placeholder with the 
key "stop".</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><h3 
id="UsingPropertyPlaceholder-UsingPropertyPlaceholdersforAnyKindofAttributeintheXMLDSL">Using
 Property Placeholders for Any Kind of Attribute in the XML 
DSL</h3><p><strong>Available as of Camel 2.7</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>If you use OSGi Blueprint then 
this only works from <strong>2.11.1</strong> or <strong>2.10.5</strong> 
on.</p></div></div><p>Previously it was only the 
<strong><code>xs:string</code></strong> type attributes in the XML DSL that 
support placeholders. For example often a timeout attribute would be a 
<strong><code>xs:int</code></strong> type and thus you cannot set a string 
value as the placeholder key. This is now possible from Camel 2.7 on using a 
special placeholder namespace.</p><p>In the example below we use the 
<code>prop</code> pre
 fix for the namespace <code><a shape="rect" class="external-link" 
href="http://camel.apache.org/schema/placeholder";>http://camel.apache.org/schema/placeholder</a></code>
 by which we can use the <strong><code>prop</code></strong> prefix in the 
attributes in the XML DSLs. Notice how we use that in the <a shape="rect" 
href="multicast.html">Multicast</a> to indicate that the option 
<strong><code>stopOnException</code></strong> should be the value of the 
placeholder with the key <strong><code>stop</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;beans 
xmlns=&quot;http://www.springframework.org/schema/beans&quot;
        xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
        xmlns:prop=&quot;http://camel.apache.org/schema/placeholder&quot;
@@ -279,20 +285,21 @@ assertMockEndpointsSatisfied();
                 &lt;to uri=&quot;mock:b&quot;/&gt;
             &lt;/multicast&gt;
         &lt;/route&gt;
-
     &lt;/camelContext&gt;
-
 &lt;/beans&gt;]]></script>
 </div></div><p>In our properties file we have the value defined 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[stop=true
 ]]></script>
-</div></div><h3 
id="UsingPropertyPlaceholder-UsingpropertyplaceholderintheJavaDSL">Using 
property placeholder in the Java DSL</h3><p><strong>Available as of Camel 
2.7</strong></p><p>Likewise we have added support for defining placeholders in 
the Java DSL using the new <code>placeholder</code> DSL as shown in the 
following equivalent 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[                from(&quot;direct:start&quot;)
-                    // use a property placeholder for the option 
stopOnException on the Multicast EIP
-                    // which should have the value of {{stop}} key being 
looked up in the properties file
-                    .multicast().placeholder(&quot;stopOnException&quot;, 
&quot;stop&quot;)
-                        .to(&quot;mock:a&quot;).throwException(new 
IllegalAccessException(&quot;Damn&quot;)).to(&quot;mock:b&quot;);]]></script>
-</div></div><h3 
id="UsingPropertyPlaceholder-UsingBlueprintpropertyplaceholderwithCamelroutes">Using
 Blueprint property placeholder with Camel routes</h3><p><strong>Available as 
of Camel 2.7</strong></p><p>Camel supports <a shape="rect" 
href="using-osgi-blueprint-with-camel.html">Blueprint</a> which also offers a 
property placeholder service. Camel supports convention over configuration, so 
all you have to do is to define the OSGi Blueprint property placeholder in the 
XML file as shown below:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 
id="UsingPropertyPlaceholder-UsingPropertyPlaceholderintheJavaDSL">Using 
Property Placeholder in the Java DSL</h3><p><strong>Available as of Camel 
2.7</strong></p><p>Likewise we have added support for defining placeholders in 
the Java DSL using the new <strong><code>placeholder</code></strong> DSL as 
shown in the following equivalent 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[from(&quot;direct:start&quot;)
+  // use a property placeholder for the option stopOnException on the 
Multicast EIP
+  // which should have the value of {{stop}} key being looked up in the 
properties file
+  .multicast()
+  .placeholder(&quot;stopOnException&quot;, &quot;stop&quot;)
+  .to(&quot;mock:a&quot;)
+  .throwException(new IllegalAccessException(&quot;Damn&quot;))
+  .to(&quot;mock:b&quot;);]]></script>
+</div></div><h3 
id="UsingPropertyPlaceholder-UsingBlueprintPropertyPlaceholderwithCamelRoutes">Using
 Blueprint Property Placeholder with Camel Routes</h3><p><strong>Available as 
of Camel 2.7</strong></p><p>Camel supports <a shape="rect" 
href="using-osgi-blueprint-with-camel.html">Blueprint</a> which also offers a 
property placeholder service. Camel supports convention over configuration, so 
all you have to do is to define the OSGi Blueprint property placeholder in the 
XML file as shown 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;
@@ -317,7 +324,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><code style="line-height: 
1.42857;">useBlueprintPropertyResolver</code><span style="line-height: 
1.42857;"> to false on the </span><code style="line-height: 
1.42857;">&lt;camelContext&gt;</code><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 {{ }} in the Camel route, which will lookup the value 
from OSGi blueprint.<br clear="none"> The blueprint syntax for placeholders is 
${ }. So outside the &lt;cam
 elContext&gt; you must use the ${ } syntax. Where as inside 
&lt;camelContext&gt; you must use {{ }} syntax.<br clear="none"> 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 
&lt;propertyPlaceholder&gt; 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;"><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">
 <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;
@@ -346,10 +353,10 @@ assertMockEndpointsSatisfied();
         &lt;/route&gt;
     &lt;/camelContext&gt;
 &lt;/blueprint&gt;]]></script>
-</div></div><p>&#160;</p><p>Notice how we use the <code>blueprint</code> 
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>&#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">
 <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">
+</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">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;!-- blueprint property placeholders --&gt;
 &lt;cm:property-placeholder persistent-id=&quot;my-placeholders&quot; 
update-strategy=&quot;reload&quot;&gt;
@@ -374,7 +381,7 @@ assertMockEndpointsSatisfied();
 
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>Notice that we have a &lt;bean&gt; which refers to one of the 
properties. And in the Camel route we refer to the other using the {{ }} 
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">
+</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) {
@@ -385,7 +392,7 @@ protected String useOverridePropertiesWi
     return &quot;my-placeholders&quot;;
 }
 ]]></script>
-</div></div>To do this we override and implement the 
<code>useOverridePropertiesWithConfigAdmin</code> method. We can then put the 
properties we want to override on the given props parameter. And the return 
value <strong>must</strong> be the persistence-id of the 
&lt;cm:property-placeholder&gt; tag, which you define in the blueprint XML 
file.<h4 
id="UsingPropertyPlaceholder-Using.cfgor.propertiesfileforBlueprintpropertyplaceholders">Using
 .cfg or .properties 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 .cfg file. If you use Apache ServieMix / 
Karaf then this container has a convention that it loads the properties from a 
file in the etc directory with the naming etc/pid.cfg, where pid is the 
persistence-id.</p><p>For example in the blueprint XML file we have the 
persistence-id="stuff", which mean it will load th
 e configuration file as etc/stuff.cfg.</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 
ServieMix/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;
@@ -405,7 +412,7 @@ protected String useOverridePropertiesWi
 
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>Now if you want to unit test this blueprint XML file, then you can 
override the <code>loadConfigAdminConfigurationFile</code> and tell Camel which 
file to load as shown below:<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() {
@@ -414,11 +421,11 @@ protected String[] loadConfigAdminConfig
     return new String[]{&quot;src/test/resources/etc/stuff.cfg&quot;, 
&quot;stuff&quot;};
 }
 ]]></script>
-</div></div>Notice that this method requires to return a String[] with 2 
values. The 1st value is the path for the configuration file to load.<br 
clear="none"> The 2nd value is the persistence-id of the 
&lt;cm:property-placeholder&gt; tag.<p>The stuff.cfg 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 2nd 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>
-</div></div><h4 
id="UsingPropertyPlaceholder-Using.cfgfileandoverridingpropertiesforBlueprintpropertyplaceholders">Using
 .cfg file and overriding properties for Blueprint property 
placeholders</h4><p>You can do both as well. Here is a complete example. First 
we have the Blueprint XML file:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h4 
id="UsingPropertyPlaceholder-Usinga.cfgfileandOverridingPropertiesforBlueprintPropertyPlaceholders">Using
 a <code>.cfg</code> file and Overriding Properties for Blueprint Property 
Placeholders</h4><p>You can do both as well. Here is a complete example. First 
we have the Blueprint XML file:</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;
@@ -501,12 +508,12 @@ public class ConfigAdminLoadConfiguratio
 
 }
 ]]></script>
-</div></div>And the <code>etc/stuff.cfg</code> configuration file contains<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
 ]]></script>
-</div></div><h3 
id="UsingPropertyPlaceholder-BridgingSpringandCamelpropertyplaceholders">Bridging
 Spring and Camel property placeholders</h3><p><strong>Available as of Camel 
2.10</strong></p><p>The Spring Framework does not allow 3rd party frameworks 
such as Apache Camel to seamless hook into the Spring property placeholder 
mechanism. However you can easily bridge Spring and Camel by declaring a Spring 
bean with the type 
<code>org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer</code>, 
which is a Spring 
<code>org.springframework.beans.factory.config.PropertyPlaceholderConfigurer</code>
 type.</p><p>To bridge Spring and Camel you must define a single bean as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Bridging Spring and Camel property placeholders</b></div><div 
class="codeContent panelContent pdl">
+</div></div><h3 
id="UsingPropertyPlaceholder-BridgingSpringandCamelPropertyPlaceholders">Bridging
 Spring and Camel Property Placeholders</h3><p><strong>Available as of Camel 
2.10</strong></p><p>The Spring Framework does not allow 3rd party frameworks 
such as Apache Camel to seamless hook into the Spring property placeholder 
mechanism. However you can easily bridge Spring and Camel by declaring a Spring 
bean with the type 
<strong><code>org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer</code></strong>,
 which is a Spring 
<strong><code>org.springframework.beans.factory.config.PropertyPlaceholderConfigurer</code></strong>
 type.</p><p>To bridge Spring and Camel you must define a single bean as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Bridging Spring and Camel property placeholders</b></div><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 
 &lt;!-- bridge spring property placeholder with Camel --&gt;
@@ -516,7 +523,7 @@ destination=mock:result
 &lt;/bean&gt;
 
 ]]></script>
-</div></div>You <strong>must not</strong> use the spring 
&lt;context:property-placeholder&gt; 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 
&lt;camelContext&gt; 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;
@@ -535,17 +542,17 @@ destination=mock:result
 &lt;/camelContext&gt;
 
 ]]></script>
-</div></div>Notice how the hello bean is using pure Spring property 
placeholders using the ${ } notation. And in the Camel routes we use the Camel 
placeholder notation with {{ }}.<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 ${ } syntax clashes with the <a 
shape="rect" href="simple.html">Simple</a> in Camel, and therefore take care. 
For 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[&lt;setHeader 
headerName=&quot;Exchange.FILE_NAME&quot;&gt;
+</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;
 ]]></script>
-</div></div><p>clashes with Spring property placeholders, and you should use 
$simple{ } to indicate using the <a shape="rect" href="simple.html">Simple</a> 
language in Camel.</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[&lt;setHeader 
headerName=&quot;Exchange.FILE_NAME&quot;&gt;
+</div></div><p>clashes with Spring property placeholders, and you should 
use&#160;<strong><code>$simple{}</code></strong> to indicate using the <a 
shape="rect" href="simple.html">Simple</a> language in Camel.</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}}/$simple{in.header.CamelFileName}&lt;/simple&gt;
 &lt;/setHeader&gt;
 ]]></script>
-</div></div><p>An alternative is to configure the 
<code>PropertyPlaceholderConfigurer</code> with 
<code>ignoreUnresolvablePlaceholders</code> option to <code>true</code>.</p><h3 
id="UsingPropertyPlaceholder-OverridingpropertiesfromCameltestkit">Overriding 
properties from Camel test kit</h3><p><strong>Available as of Camel 
2.10</strong></p><p>When <a shape="rect" href="testing.html">Testing</a> with 
Camel and using the <a shape="rect" href="properties.html">Properties</a> 
component, you may want to be able to provide the properties to be used from 
directly within the unit test source code.<br clear="none"> This is now 
possible from Camel 2.10 onwards, as the Camel test kits, eg 
<code>CamelTestSupport</code> class offers the following methods</p><ul 
class="alternate"><li>useOverridePropertiesWithPropertiesComponent</li><li>ignoreMissingLocationWithPropertiesComponent</li></ul><p>So
 for example in your unit test classes, you can override the 
<code>useOverridePropertiesWithPropertiesCom
 ponent</code> method and return a <code>java.util.Properties</code> that 
contains the properties which should be preferred to be used.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Providing properties from 
within unit test source</b></div><div class="codeContent panelContent pdl">
+</div></div><p>An alternative is to configure the 
<strong><code>PropertyPlaceholderConfigurer</code></strong> with 
<strong><code>ignoreUnresolvablePlaceholders</code></strong> option to 
<strong><code>true</code></strong>.</p><h3 
id="UsingPropertyPlaceholder-OverridingPropertiesfromCamelTestKit">Overriding 
Properties from Camel Test Kit</h3><p><strong>Available as of Camel 
2.10</strong></p><p>When <a shape="rect" href="testing.html">Testing</a> with 
Camel and using the <a shape="rect" href="properties.html">Properties</a> 
component, you may want to be able to provide the properties to be used from 
directly within the unit test source code. This is now possible from Camel 
2.10, as the Camel test kits, e.g., 
<strong><code>CamelTestSupport</code></strong> class offers the following 
methods</p><ul 
class="alternate"><li><strong><code>useOverridePropertiesWithPropertiesComponent</code></strong></li><li><strong><code>ignoreMissingLocationWithPropertiesComponent</code></strong></li></ul><p>S
 o for example in your unit test classes, you can override the 
<strong><code>useOverridePropertiesWithPropertiesComponent</code></strong> 
method and return a <strong><code>java.util.Properties</code></strong> that 
contains the properties which should be preferred to be used.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Providing properties from 
within unit test source</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 // override this method to provide our custom properties we use in this unit 
test
 @Override
@@ -556,7 +563,7 @@ protected Properties useOverrideProperti
     return extra;
 }
 ]]></script>
-</div></div>This can be done from any of the Camel Test kits, such as 
camel-test, camel-test-spring, and camel-test-blueprint.<p>The 
<code>ignoreMissingLocationWithPropertiesComponent</code> 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 
@PropertyInject</h3><p><strong>Available as of Camel 2.12</strong></p><p>Camel 
allows to inject property placeholders in POJOs using the @PropertyInject 
annotation which can be set on fields and setter methods.<br clear="none"> For 
example you can use that with <code>RouteBuilder</code> classes, such as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div>This can be done from any of the Camel Test kits, such as 
<code>camel-test</code>, <code>camel-test-spring</code> and 
<code>camel-test-blueprint</code>.<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 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[public class MyRouteBuilder extends 
RouteBuilder {
 
     @PropertyInject(&quot;hello&quot;)
@@ -568,89 +575,79 @@ protected Properties useOverrideProperti
             .transform().constant(greeting)
             .to(&quot;{{result}}&quot;);
     }
-
 }
 ]]></script>
-</div></div><p>Notice we have annotated the greeting field with 
@PropertyInject and define it to use the key "hello". Camel will then lookup 
the property with this key and inject its value, converted to a String 
type.</p><p>You can also use multiple placeholders and text in the key, for 
example we 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[    @PropertyInject(&quot;Hello {{name}} how 
are you?&quot;)
-    private String greeting;
+</div></div><p>Notice we have annotated the greeting field 
with&#160;<strong><code>@PropertyInject</code></strong> and define it to use 
the key <strong><code>hello</code></strong>. Camel will then lookup the 
property with this key and inject its value, converted to a String 
type.</p><p>You can also use multiple placeholders and text in the key, for 
example we 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[@PropertyInject(&quot;Hello {{name}} how are 
you?&quot;)
+private String greeting;
+]]></script>
+</div></div><p>This will lookup the placeholder with they key 
<strong><code>name</code></strong>.</p><p>You can also add a default value if 
the key does not exists, 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[@PropertyInject(value = 
&quot;myTimeout&quot;, defaultValue = &quot;5000&quot;)
+private int timeout;
 ]]></script>
-</div></div><p>This will lookup the placeholder with they key 
"name".</p><p>You can also add a default value if the key does not exists, 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[    @PropertyInject(value = 
&quot;myTimeout&quot;, defaultValue = &quot;5000&quot;)
-    private int timeout;
-]]></script>
-</div></div><h3 id="UsingPropertyPlaceholder-Usingoutoftheboxfunctions">Using 
out of the box functions</h3><p><strong>Available as of Camel 
2.14.1</strong></p><p>The&#160;<a shape="rect" 
href="properties.html">Properties</a>&#160;component includes the following 
functions out of the box</p><ul><li>env - A function to lookup the property 
from OS environment variables</li><li>sys - A function to lookup the property 
from Java JVM system properties</li><li>service - A function to lookup the 
property from OS environment variables using the service naming 
idiom</li><li>service.host - <strong>Camel 2.16.1:&#160;</strong>A function to 
lookup the property&#160;from OS environment variables using the service naming 
idiom returning the hostname part only</li><li>service.port&#160;- 
<strong>Camel 2.16.1:&#160;</strong>A function to lookup the property&#160;from 
OS environment variables using the service naming idiom returning the port part 
only</li></ul><p>As you can see these functions is inte
 nded to make it easy to lookup values from the environment. As they are 
provided out of the box, they can easily be used 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[  &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;{{env:SOMENAME}}&quot;/&gt;
-      &lt;to uri=&quot;{{sys:MyJvmPropertyName}}&quot;/&gt;
-    &lt;/route&gt;
-  &lt;/camelContext&gt;]]></script>
-</div></div><p>You can use default values as well, so if the property does not 
exists, you can define a default value as shown below, where the default value 
is a log:foo and log:bar value.</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[  &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;{{env:SOMENAME:log:foo}}&quot;/&gt;
-      &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 hostname : 
port</p><ul><li><em>NAME</em><strong>_SERVICE_HOST</strong></li><li><em>NAME</em><strong>_SERVICE_PORT</strong></li></ul><p>in
 other words the service uses _SERVICE_HOST and _SERVICE_PORT as prefix. So if 
the service is named FOO, 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><h3 id="UsingPropertyPlaceholder-UsingOutoftheBoxFunctions">Using 
Out of the Box Functions</h3><p><strong>Available as of Camel 
2.14.1</strong></p><p>The&#160;<a shape="rect" 
href="properties.html">Properties</a>&#160;component includes the following 
functions out of the box</p><ul><li><code>env</code> - A function to lookup the 
property from OS environment variables.</li><li><code>sys</code> - A function 
to lookup the property from Java JVM system 
properties.</li><li><code>service</code> - A function to lookup the property 
from OS environment variables using the service naming 
idiom.</li><li><code>service.host</code> - <strong>Camel 
2.16.1:&#160;</strong>A function to lookup the property&#160;from OS 
environment variables using the service naming idiom returning the hostname 
part only.</li><li><code>service.port</code> - <strong>Camel 
2.16.1:&#160;</strong>A function to lookup the property&#160;from OS 
environment variables using the service naming idiom returning the p
 ort part only.</li></ul><p>As you can see these functions is intended to make 
it easy to lookup values from the environment. As they are provided out of the 
box, they can easily be used as shown 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;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;{{env:SOMENAME}}&quot;/&gt;
+    &lt;to uri=&quot;{{sys:MyJvmPropertyName}}&quot;/&gt;
+  &lt;/route&gt;
+&lt;/camelContext&gt;]]></script>
+</div></div><p>You can use default values as well, so if the property does not 
exists, you can define a default value as shown below, where the default value 
is a&#160;<strong><code>log:foo</code></strong> 
and&#160;<strong><code>log:bar</code></strong> value.</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;{{env:SOMENAME:log:foo}}&quot;/&gt;
+    &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">
 <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 FOO 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: java; 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">
-<script class="brush: java; 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:localhost:8080}}/myapp&quot;/&gt;
-    &lt;/route&gt;
-  &lt;/camelContext&gt;]]></script>
-</div></div><h3 id="UsingPropertyPlaceholder-Usingcustomfunctions">Using 
custom functions</h3><p><strong>Available as of Camel 2.14.1</strong></p><p>The 
<a shape="rect" href="properties.html">Properties</a> component allow to plugin 
3rd party functions which can be used during&#160;parsing of the property 
placeholders. These functions are then able to do custom logic to resolve the 
placeholders, such as looking up in databases, do custom computations, or 
whatnot. The name of the function becomes the prefix used in the placeholder. 
This is best illustrated in the example code 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[  &lt;bean id=&quot;beerFunction&quot; 
class=&quot;MyBeerFunction&quot;/&gt;
-
-  &lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
-    &lt;propertyPlaceholder id=&quot;properties&quot; 
location=&quot;none&quot; ignoreMissingLocation=&quot;true&quot;&gt;
-      &lt;propertiesFunction ref=&quot;beerFunction&quot;/&gt;
-    &lt;/propertyPlaceholder&gt;
-
-    &lt;route&gt;
-      &lt;from uri=&quot;direct:start&quot;/&gt;
-      &lt;to uri=&quot;{{beer:FOO}}&quot;/&gt;
-      &lt;to uri=&quot;{{beer:BAR}}&quot;/&gt;
-    &lt;/route&gt;
-  &lt;/camelContext&gt;]]></script>
-</div></div><p>Here we have a Camel XML route where we have defined the 
&lt;propertyPlaceholder&gt; to use a custom function, which we refer to be the 
bean id - eg the beerFunction. As the beer function uses "beer" as its name, 
then the placeholder syntax can trigger the beer function by starting with 
beer:value.</p><p>The implementation of the function is only two methods 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[    public static final class MyBeerFunction 
implements PropertiesFunction {
-
-        @Override
-        public String getName() {
-            return &quot;beer&quot;;
-        }
-
-        @Override
-        public String apply(String remainder) {
-            return &quot;mock:&quot; + remainder.toLowerCase();
-        }
-    }
+</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">
+<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">
+<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:localhost:8080}}/myapp&quot;/&gt;
+  &lt;/route&gt;
+&lt;/camelContext&gt;]]></script>
+</div></div><h3 id="UsingPropertyPlaceholder-UsingCustomFunctions">Using 
Custom Functions</h3><p><strong>Available as of Camel 2.14.1</strong></p><p>The 
<a shape="rect" href="properties.html">Properties</a> component allow to plugin 
3rd party functions which can be used during&#160;parsing of the property 
placeholders. These functions are then able to do custom logic to resolve the 
placeholders, such as looking up in databases, do custom computations, or 
whatnot. The name of the function becomes the prefix used in the placeholder. 
This is best illustrated in the example code 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;bean id=&quot;beerFunction&quot; 
class=&quot;MyBeerFunction&quot;/&gt;
 
-]]></script>
-</div></div><p>The function must implement 
the&#160;<code>org.apache.camel.component.properties.PropertiesFunction</code> 
interface. The method&#160;<code>getName</code> is &#160;the name of the 
function, eg beer. And the&#160;<code>apply</code> method is where we implement 
the custom logic to do. As the sample code is from an unit test, it just 
returns a value to refer to a mock endpoint.</p><p>To register a custom 
function from Java code is 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[        PropertiesComponent pc = 
context.getComponent(&quot;properties&quot;, PropertiesComponent.class);
-        pc.addFunction(new MyBeerFunction());
+&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
+  &lt;propertyPlaceholder id=&quot;properties&quot; location=&quot;none&quot; 
ignoreMissingLocation=&quot;true&quot;&gt;
+    &lt;propertiesFunction ref=&quot;beerFunction&quot;/&gt;
+  &lt;/propertyPlaceholder&gt;
 
+  &lt;route&gt;
+    &lt;from uri=&quot;direct:start&quot;/&gt;
+    &lt;to uri=&quot;{{beer:FOO}}&quot;/&gt;
+    &lt;to uri=&quot;{{beer:BAR}}&quot;/&gt;
+  &lt;/route&gt;
+&lt;/camelContext&gt;]]></script>
+</div></div><p>Here we have a Camel XML route where we have defined 
the&#160;<strong><code>&lt;propertyPlaceholder&gt;</code></strong> to use a 
custom function, which we refer to be the bean id - e.g., the 
<strong><code>beerFunction</code></strong>. As the beer function 
uses&#160;<strong><code>beer</code></strong> as its name, then the placeholder 
syntax can trigger the beer function by starting with 
<strong><code>beer:value</code></strong>.</p><p>The implementation of the 
function is only two methods 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[public static final class MyBeerFunction 
implements PropertiesFunction {
+  @Override
+  public String getName() {
+    return &quot;beer&quot;;
+  }
+  @Override
+  public String apply(String remainder) {
+    return &quot;mock:&quot; + remainder.toLowerCase();
+  }
+}]]></script>
+</div></div><p>The function must implement 
the&#160;<strong><code>org.apache.camel.component.properties.PropertiesFunction</code></strong>
 interface. The method&#160;<strong><code>getName</code></strong> is &#160;the 
name of the function, e.g., <strong><code>beer</code></strong>. And 
the&#160;<strong><code>apply</code></strong> method is where we implement the 
custom logic to do. As the sample code is from an unit test, it just returns a 
value to refer to a mock endpoint.</p><p>To register a custom function from 
Java code is 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[PropertiesComponent pc = 
context.getComponent(&quot;properties&quot;, PropertiesComponent.class);
+pc.addFunction(new MyBeerFunction());
 ]]></script>
-</div></div><p>&#160;</p><h2 id="UsingPropertyPlaceholder-SeeAlso">See 
Also</h2><ul class="alternate"><li><a shape="rect" 
href="properties.html">Properties</a> component</li></ul></div>
+</div></div><h2 id="UsingPropertyPlaceholder-SeeAlso">See Also</h2><ul 
class="alternate"><li><a shape="rect" href="properties.html">Properties</a> 
component</li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">


Reply via email to