Modified: websites/production/camel/content/using-propertyplaceholder.html
==============================================================================
--- websites/production/camel/content/using-propertyplaceholder.html (original)
+++ websites/production/camel/content/using-propertyplaceholder.html Fri Aug 25 
09:20:43 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' 
rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' 
rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' 
type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: Using PropertyPlaceholder
@@ -86,585 +75,305 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 
id="UsingPropertyPlaceholder-UsingPropertyPlaceholder">Using&#160;<strong><code>PropertyPlaceholder</code></strong></h2><p><strong>Available
 as of Camel 2.3</strong></p><p>Camel now provides a new 
<strong><code>PropertiesComponent</code></strong> 
in&#160;<strong><code>camel-core</code></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 has a limitation that prevents third-party frameworks from fully 
leveraging Spring property placeholders.</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 Proper
 ty 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 typically used when 
trying to do any of the following:</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-Format">Format</h3><p>The 
value of a Camel property can be obtained by specifying its key name within a 
property placeholder, using the following format: 
<strong>{{<code>key</code>}}</strong>.</p><p>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[{{file.uri}}]]></script>
-</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>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">
-<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
-]]></script>
-</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 <strong><code>APP_HOME</code></strong> is an OS 
environment variable.</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-UsingSystemorEnvironmentVariablestoConfigurePropertyPrefixesandSuffixes">Using
 System or Environment Variables to Configure Property Prefixes and 
Suffixes</h4><p>From<strong> Camel 2.12.5, 2.13.3, 
2.14.0</strong>:<strong><code> propertyPrefix</code></strong>, 
<strong><code>propertySuffix</code></strong> configuration properties support 
the use of placeholders for de-referencing JVM system properties and OS 
environments variables.</p><p>Example:</p><p>Assume the 
<strong><code>PropertiesComponent</code></strong> is configured with the 
following properties file:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[dev.endpoint = result1
-test.endpoint = result2]]></script>
-</div></div><p>The same properties file is then referenced from a 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;);
+<div class="wiki-content maincontent"><h2 
id="UsingPropertyPlaceholder-UsingPropertyPlaceholder">Using&#160;<strong><code>PropertyPlaceholder</code></strong></h2><p><strong>Available
 as of Camel 2.3</strong></p><p>Camel now provides a new 
<strong><code>PropertiesComponent</code></strong> 
in&#160;<strong><code>camel-core</code></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 has a limitation that prevents third-party frameworks from fully 
leveraging Spring property placeholders.</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><parameter 
ac:name="title">Bridging Spring and Camel Property 
Placeholders</parameter><rich-text-body><p>From <strong>Camel 
 2.10</strong>: Spring's property placeholder can be bridged with Camel's. See 
below for more details.</p></rich-text-body><p>The property placeholder is 
typically used when trying to do any of the following:</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 ca
 n be plugged into the property component.</li></ul><h3 
id="UsingPropertyPlaceholder-Format">Format</h3><p>The value of a Camel 
property can be obtained by specifying its key name within a property 
placeholder, using the following format: 
<strong>{{<code>key</code>}}</strong>.</p><p>For 
example:</p><plain-text-body>{{file.uri}}</plain-text-body><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><rich-text-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></rich-text-body><h3 
id="UsingPropertyPlaceholder-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" rows
 pan="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 multip
 le locations can be done a couple of ways: using either a single comma 
separated string, or an array of strings.</p><parameter 
ac:name="language">java</parameter><plain-text-body>pc.setLocation("com/mycompany/myprop.properties,com/mycompany/other.properties");
+pc.setLocation(new String[] {"com/mycompany/myprop.properties", 
"com/mycompany/other.properties"});&#160;</plain-text-body><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><p>&#160;</p><parameter 
ac:name="language">java</parameter><plain-text-body>pc.setLocations("com/mycompany/override.properties;optional=true,com/mycompany/defaults.properties");</plain-text-body><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><plain-text-body>location=file:${karaf.home}/etc/foo.properties
+</plain-text-body><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><plain-text-body>location=file:${env:APP_HOME}/etc/foo.properties
+</plain-text-body><p>Where <strong><code>APP_HOME</code></strong> is an OS 
environment variable.</p><p>You can have multiple placeholders in the same 
location, such 
as:</p><plain-text-body>location=file:${env:APP_HOME}/etc/${prop.name}.properties
+</plain-text-body><h4 
id="UsingPropertyPlaceholder-UsingSystemorEnvironmentVariablestoConfigurePropertyPrefixesandSuffixes">Using
 System or Environment Variables to Configure Property Prefixes and 
Suffixes</h4><p>From<strong> Camel 2.12.5, 2.13.3, 
2.14.0</strong>:<strong><code> propertyPrefix</code></strong>, 
<strong><code>propertySuffix</code></strong> configuration properties support 
the use of placeholders for de-referencing JVM system properties and OS 
environments variables.</p><p>Example:</p><p>Assume the 
<strong><code>PropertiesComponent</code></strong> is configured with the 
following properties file:</p><parameter 
ac:name="language">text</parameter><plain-text-body>dev.endpoint = result1
+test.endpoint = result2</plain-text-body><p>The same properties file is then 
referenced from a route definition:</p><parameter 
ac:name="language">java</parameter><plain-text-body>PropertiesComponent pc = 
context.getComponent("properties", PropertiesComponent.class);
+pc.setPropertyPrefix("${stage}.");
 
 // ...
 context.addRoutes(new RouteBuilder() {
     @Override
     public void configure() throws Exception {
-        from(&quot;direct:start&quot;)
-          .to(&quot;properties:mock:{{endpoint}}&quot;);
+        from("direct:start")
+          .to("properties:mock:{{endpoint}}");
     }
-});]]></script>
-</div></div><p>By using the configuration options 
<strong><code>propertyPrefix</code></strong> it's possible to change the target 
endpoint simply by changing the value of the 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 <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;
+});</plain-text-body><p>By using the configuration options 
<strong><code>propertyPrefix</code></strong> it's possible to change the target 
endpoint simply by changing the value of the 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><parameter 
ac:name="language">java</parameter><plain-text-body>PropertiesComponent pc = 
new PropertiesComponent();
+pc.setLocation("classpath:com/mycompany/myprop.properties");
+context.addComponent("properties", pc);
+</plain-text-body><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><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;bean id="properties" 
class="org.apache.camel.component.properties.PropertiesComponent"&gt;
+    &lt;property name="location" 
value="classpath:com/mycompany/myprop.properties"/&gt;
 &lt;/bean&gt;
-]]></script>
-</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;
+</plain-text-body><p>Using the 
<strong><code>&lt;propertyPlaceholder&gt;</code></strong> tag makes the 
configuration a bit more fresh such as:</p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;camelContext ...&gt;
+   &lt;propertyPlaceholder id="properties" 
location="com/mycompany/myprop.properties"/&gt;
 &lt;/camelContext&gt;
-]]></script>
-</div></div><p><span>Setting the properties location through the location tag 
works just fine but sometime you have a number of resources to take into 
account and starting from&#160;</span><strong>Camel 
2.19.0</strong><span>&#160;you can set the properties location with a dedicated 
<strong><code>propertiesLocation</code></strong>:</span></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;myPropertyPlaceholder&quot;&gt;
+</plain-text-body><p><span>Setting the properties location through the 
location tag works just fine but sometime you have a number of resources to 
take into account and starting from&#160;</span><strong>Camel 
2.19.0</strong><span>&#160;you can set the properties location with a dedicated 
<strong><code>propertiesLocation</code></strong>:</span></p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;camelContext ...&gt;
+  &lt;propertyPlaceholder id="myPropertyPlaceholder"&gt;
     &lt;propertiesLocation
-      resolver = &quot;classpath&quot;
-      path     = 
&quot;com/my/company/something/my-properties-1.properties&quot;
-      optional = &quot;false&quot;/&gt;
+      resolver = "classpath"
+      path     = "com/my/company/something/my-properties-1.properties"
+      optional = "false"/&gt;
     &lt;propertiesLocation
-      resolver = &quot;classpath&quot;
-      path     = 
&quot;com/my/company/something/my-properties-2.properties&quot;
-      optional = &quot;false&quot;/&gt;
+      resolver = "classpath"
+      path     = "com/my/company/something/my-properties-2.properties"
+      optional = "false"/&gt;
     &lt;propertiesLocation
-      resolver = &quot;file&quot;
-      path     = &quot;${karaf.home}/etc/my-override.properties&quot;
-      optional = &quot;true&quot;/&gt;
+      resolver = "file"
+      path     = "${karaf.home}/etc/my-override.properties"
+      optional = "true"/&gt;
    &lt;/propertyPlaceholder&gt;
-&lt;/camelContext&gt;]]></script>
-</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 <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
+&lt;/camelContext&gt;</plain-text-body><parameter ac:name="title">Specifying 
the cache option in XML</parameter><rich-text-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></rich-text-body><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><parameter 
ac:name="">xml</parameter><plain-text-body>&lt;propertyPlaceholder 
id="properties" location="ref:myProperties"/&gt;
+</plain-text-body><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><parameter 
ac:name="language">java</parameter><plain-text-body>// properties
 cool.end=mock:result
 
 // route
-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">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[// properties
+from("direct:start")
+  .to("properties:{{cool.end}}");
+</plain-text-body><p>You can also use placeholders as a part of the endpoint 
URI:</p><parameter ac:name="language">java</parameter><plain-text-body>// 
properties
 cool.foo=result
 
 // route
-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 
<strong><code>mock:result</code></strong>.</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
+from("direct:start")
+  .to("properties:mock:{{cool.foo}}");
+</plain-text-body><p>In the example above the to endpoint will be resolved to 
<strong><code>mock:result</code></strong>.</p><p>You can also have properties 
with refer to each other such as:</p><parameter 
ac:name="language">java</parameter><plain-text-body>// properties
 cool.foo=result
 cool.concat=mock:{{cool.foo}}
 
 // route
-from(&quot;direct:start&quot;)
-  .to(&quot;properties:mock:{{cool.concat}}&quot;);
-]]></script>
-</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 <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
+from("direct:start")
+  .to("properties:mock:{{cool.concat}}");
+</plain-text-body><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><parameter 
ac:name="language">java</parameter><plain-text-body>from("direct:start")
+  .to("properties:bar.end?locations=com/mycompany/bar.properties");
+</plain-text-body><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><parameter 
ac:name="language">java</parameter><plain-text-body>// properties
 cool.foo=result
 
 // route
-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
+from("direct:start")
+  .to("mock:{{cool.foo}}");
+</plain-text-body><p>And you can use them in multiple wherever you want 
them:</p><parameter ac:name="language">java</parameter><plain-text-body>// 
properties
 cool.start=direct:start
 cool.showid=true
 cool.result=result
 
 // route
-from(&quot;{{cool.start}}&quot;)
-    
.to(&quot;log:{{cool.start}}?showBodyType=false&amp;showExchangeId={{cool.showid}}&quot;)
-    .to(&quot;mock:{{cool.result}}&quot;);
-]]></script>
-</div></div><p>You can also your property placeholders when using <a 
shape="rect" href="producertemplate.html">ProducerTemplate</a> 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[template.sendBody(&quot;{{cool.start}}&quot;, 
&quot;Hello World&quot;);
-]]></script>
-</div></div><h3 id="UsingPropertyPlaceholder-Examplewithlanguage">Example with 
<a shape="rect" href="simple.html">Simple</a> language</h3><p>The <a 
shape="rect" href="simple.html">Simple</a> language now also support using 
property placeholders, for example in the route 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[// properties
+from("{{cool.start}}")
+    
.to("log:{{cool.start}}?showBodyType=false&amp;showExchangeId={{cool.showid}}")
+    .to("mock:{{cool.result}}");
+</plain-text-body><p>You can also your property placeholders when using <a 
shape="rect" href="producertemplate.html">ProducerTemplate</a> for 
example:</p><parameter 
ac:name="language">java</parameter><plain-text-body>template.sendBody("{{cool.start}}",
 "Hello World");
+</plain-text-body><h3 
id="UsingPropertyPlaceholder-Examplewithlanguage">Example with <a shape="rect" 
href="simple.html">Simple</a> language</h3><p>The <a shape="rect" 
href="simple.html">Simple</a> language now also support using property 
placeholders, for example in the route below:</p><parameter 
ac:name="language">java</parameter><plain-text-body>// properties
 cheese.quote=Camel rocks
 
 // route
-from(&quot;direct:start&quot;)
-    .transform().simple(&quot;Hi ${body} do you think 
${properties:cheese.quote}?&quot;);
-]]></script>
-</div></div><p>You can also specify the location in the <a shape="rect" 
href="simple.html">Simple</a> language 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[// bar.properties
+from("direct:start")
+    .transform().simple("Hi ${body} do you think ${properties:cheese.quote}?");
+</plain-text-body><p>You can also specify the location in the <a shape="rect" 
href="simple.html">Simple</a> language for example:</p><parameter 
ac:name="language">java</parameter><plain-text-body>// bar.properties
 bar.quote=Beer tastes good
 
 // route
-from(&quot;direct:start&quot;)
-    .transform().simple(&quot;Hi ${body}. 
${properties:com/mycompany/bar.properties:bar.quote}.&quot;);
-]]></script>
-</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>Example:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Using property 
placeholders in the &lt;jmxAgent&gt; tag</b></div><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;
+from("direct:start")
+    .transform().simple("Hi ${body}. 
${properties:com/mycompany/bar.properties:bar.quote}.");
+</plain-text-body><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>Example:</p><parameter 
ac:name="language">xml</parameter><parameter ac:name="title">Using property 
placeholders in the &lt;jmxAgent&gt; 
tag</parameter><plain-text-body>&lt;camelContext 
xmlns="http://camel.apache.org/schema/spring"&gt;
+    &lt;propertyPlaceholder id="properties" 
location="org/apache/camel/spring/jmx.properties"/&gt;
 
     &lt;!-- we can use propery placeholders when we define the JMX agent --&gt;
-    &lt;jmxAgent id=&quot;agent&quot; registryPort=&quot;{{myjmx.port}}&quot; 
disabled=&quot;{{myjmx.disabled}}&quot;
-              usePlatformMBeanServer=&quot;{{myjmx.usePlatform}}&quot;
-              createConnector=&quot;true&quot;
-              statisticsLevel=&quot;RoutesOnly&quot;
-              useHostIPAddress=&quot;true&quot;/&gt;
-
-    &lt;route id=&quot;foo&quot; autoStartup=&quot;false&quot;&gt;
-        &lt;from uri=&quot;seda:start&quot;/&gt;
-        &lt;to uri=&quot;mock:result&quot;/&gt;
+    &lt;jmxAgent id="agent" registryPort="{{myjmx.port}}" 
disabled="{{myjmx.disabled}}"
+              usePlatformMBeanServer="{{myjmx.usePlatform}}"
+              createConnector="true"
+              statisticsLevel="RoutesOnly"
+              useHostIPAddress="true"/&gt;
+
+    &lt;route id="foo" autoStartup="false"&gt;
+        &lt;from uri="seda:start"/&gt;
+        &lt;to uri="mock:result"/&gt;
     &lt;/route&gt;
-&lt;/camelContext&gt;]]></script>
-</div></div><p>Example:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Using property placeholders in the attributes of 
&lt;camelContext&gt;</b></div><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;
+&lt;/camelContext&gt;</plain-text-body><p>Example:</p><parameter 
ac:name="language">xml</parameter><parameter ac:name="title">Using property 
placeholders in the attributes of 
&lt;camelContext&gt;</parameter><plain-text-body>&lt;camelContext 
trace="{{foo.trace}}" xmlns="http://camel.apache.org/schema/spring"&gt;
+    &lt;propertyPlaceholder id="properties" 
location="org/apache/camel/spring/processor/myprop.properties"/&gt;
 
-    &lt;template id=&quot;camelTemplate&quot; 
defaultEndpoint=&quot;{{foo.cool}}&quot;/&gt;
+    &lt;template id="camelTemplate" defaultEndpoint="{{foo.cool}}"/&gt;
 
     &lt;route&gt;
-        &lt;from uri=&quot;direct:start&quot;/&gt;
-        &lt;setHeader headerName=&quot;{{foo.header}}&quot;&gt;
+        &lt;from uri="direct:start"/&gt;
+        &lt;setHeader headerName="{{foo.header}}"&gt;
             &lt;simple&gt;${in.body} World!&lt;/simple&gt;
         &lt;/setHeader&gt;
-        &lt;to uri=&quot;mock:result&quot;/&gt;
+        &lt;to uri="mock:result"/&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.</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);
+&lt;/camelContext&gt;</plain-text-body><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><parameter 
ac:name="language">java</parameter><plain-text-body>PropertiesComponent pc = 
context.getComponent("properties", PropertiesComponent.class);
 pc.setCache(false);
         
-System.setProperty(&quot;cool.end&quot;, &quot;mock:override&quot;);
-System.setProperty(&quot;cool.result&quot;, &quot;override&quot;);
+System.setProperty("cool.end", "mock:override");
+System.setProperty("cool.result", "override");
 
 context.addRoutes(new RouteBuilder() {
     @Override
     public void configure() throws Exception {
-        from(&quot;direct:start&quot;).to(&quot;properties:cool.end&quot;);
-        
from(&quot;direct:foo&quot;).to(&quot;properties:mock:{{cool.result}}&quot;);
+        from("direct:start").to("properties:cool.end");
+        from("direct:foo").to("properties:mock:{{cool.result}}");
     }
 });
 context.start();
 
-getMockEndpoint(&quot;mock:override&quot;).expectedMessageCount(2);
+getMockEndpoint("mock:override").expectedMessageCount(2);
 
-template.sendBody(&quot;direct:start&quot;, &quot;Hello World&quot;);
-template.sendBody(&quot;direct:foo&quot;, &quot;Hello Foo&quot;);
+template.sendBody("direct:start", "Hello World");
+template.sendBody("direct:foo", "Hello Foo");
 
-System.clearProperty(&quot;cool.end&quot;);
-System.clearProperty(&quot;cool.result&quot;);
+System.clearProperty("cool.end");
+System.clearProperty("cool.result");
         
 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> 
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 
<strong><code>prop</c
 ode></strong> prefix 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;
-       xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
-                           http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd&quot;&gt;
+</plain-text-body><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><rich-text-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></rich-text-body><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 
<strong><code>prop</code></strong> prefix 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 c
 an 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><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;beans 
xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:prop="http://camel.apache.org/schema/placeholder";
+       xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd"&gt;
 
     &lt;!-- Notice in the declaration above, we have defined the prop prefix 
as the Camel placeholder namespace --&gt;
 
-    &lt;bean id=&quot;damn&quot; 
class=&quot;java.lang.IllegalArgumentException&quot;&gt;
-        &lt;constructor-arg index=&quot;0&quot; value=&quot;Damn&quot;/&gt;
+    &lt;bean id="damn" class="java.lang.IllegalArgumentException"&gt;
+        &lt;constructor-arg index="0" value="Damn"/&gt;
     &lt;/bean&gt;
 
-    &lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-        &lt;propertyPlaceholder id=&quot;properties&quot;
-                             
location=&quot;classpath:org/apache/camel/component/properties/myprop.properties&quot;
-                             
xmlns=&quot;http://camel.apache.org/schema/spring&quot;/&gt;
+    &lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
+        &lt;propertyPlaceholder id="properties"
+                             
location="classpath:org/apache/camel/component/properties/myprop.properties"
+                             xmlns="http://camel.apache.org/schema/spring"/&gt;
 
         &lt;route&gt;
-            &lt;from uri=&quot;direct:start&quot;/&gt;
+            &lt;from uri="direct:start"/&gt;
             &lt;!-- use prop namespace, to define a property placeholder, 
which maps to
                  option stopOnException={{stop}} --&gt;
-            &lt;multicast prop:stopOnException=&quot;stop&quot;&gt;
-                &lt;to uri=&quot;mock:a&quot;/&gt;
-                &lt;throwException ref=&quot;damn&quot;/&gt;
-                &lt;to uri=&quot;mock:b&quot;/&gt;
+            &lt;multicast prop:stopOnException="stop"&gt;
+                &lt;to uri="mock:a"/&gt;
+                &lt;throwException ref="damn"/&gt;
+                &lt;to uri="mock:b"/&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 <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;)
+&lt;/beans&gt;</plain-text-body><p>In our properties file we have the value 
defined as</p><plain-text-body>stop=true
+</plain-text-body><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><parameter 
ac:name="language">java</parameter><plain-text-body>from("direct:start")
   // 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;
-           xsi:schemaLocation=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;&gt;
+  .placeholder("stopOnException", "stop")
+  .to("mock:a")
+  .throwException(new IllegalAccessException("Damn"))
+  .to("mock:b");</plain-text-body><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><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;blueprint 
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+           
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0";
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"&gt;
 
     &lt;!-- OSGI blueprint property placeholder --&gt;
-    &lt;cm:property-placeholder id=&quot;myblueprint.placeholder&quot; 
persistent-id=&quot;camel.blueprint&quot;&gt;
+    &lt;cm:property-placeholder id="myblueprint.placeholder" 
persistent-id="camel.blueprint"&gt;
         &lt;!-- list some properties as needed --&gt;
         &lt;cm:default-properties&gt;
-            &lt;cm:property name=&quot;result&quot; 
value=&quot;mock:result&quot;/&gt;
+            &lt;cm:property name="result" value="mock:result"/&gt;
         &lt;/cm:default-properties&gt;
     &lt;/cm:property-placeholder&gt;
 
-    &lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
+    &lt;camelContext xmlns="http://camel.apache.org/schema/blueprint"&gt;
         &lt;!-- in the route we can use {{ }} placeholders which will lookup 
in blueprint
              as Camel will auto detect the OSGi blueprint property placeholder 
and use it --&gt;
         &lt;route&gt;
-            &lt;from uri=&quot;direct:start&quot;/&gt;
-            &lt;to uri=&quot;mock:foo&quot;/&gt;
-            &lt;to uri=&quot;{{result}}&quot;/&gt;
+            &lt;from uri="direct:start"/&gt;
+            &lt;to uri="mock:foo"/&gt;
+            &lt;to uri="{{result}}"/&gt;
         &lt;/route&gt;
     &lt;/camelContext&gt;
-&lt;/blueprint&gt;]]></script>
-</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;
-           xsi:schemaLocation=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;&gt;
+&lt;/blueprint&gt;</plain-text-body><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><parameter 
ac:name="title">About placeholder syntaxes</parameter><rich-text-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></rich-text-body><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><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;blueprint 
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+           
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0";
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"&gt;
 
     &lt;!-- OSGI blueprint property placeholder --&gt;
-    &lt;cm:property-placeholder id=&quot;myblueprint.placeholder&quot; 
persistent-id=&quot;camel.blueprint&quot;&gt;
+    &lt;cm:property-placeholder id="myblueprint.placeholder" 
persistent-id="camel.blueprint"&gt;
         &lt;!-- list some properties as needed --&gt;
         &lt;cm:default-properties&gt;
-            &lt;cm:property name=&quot;prefix.result&quot; 
value=&quot;mock:result&quot;/&gt;
+            &lt;cm:property name="prefix.result" value="mock:result"/&gt;
         &lt;/cm:default-properties&gt;
     &lt;/cm:property-placeholder&gt;
 
-    &lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
+    &lt;camelContext xmlns="http://camel.apache.org/schema/blueprint"&gt;
         &lt;!-- using Camel properties component and refer to the blueprint 
property placeholder by its id --&gt;
-        &lt;propertyPlaceholder id=&quot;properties&quot; 
location=&quot;blueprint:myblueprint.placeholder&quot;
-                             prefixToken=&quot;[[&quot; 
suffixToken=&quot;]]&quot;
-                             propertyPrefix=&quot;prefix.&quot;/&gt;
+        &lt;propertyPlaceholder id="properties" 
location="blueprint:myblueprint.placeholder"
+                             prefixToken="[[" suffixToken="]]"
+                             propertyPrefix="prefix."/&gt;
 
         &lt;!-- in the route we can use {{ }} placeholders which will lookup 
in blueprint --&gt;
         &lt;route&gt;
-            &lt;from uri=&quot;direct:start&quot;/&gt;
-            &lt;to uri=&quot;mock:foo&quot;/&gt;
-            &lt;to uri=&quot;[[result]]&quot;/&gt;
+            &lt;from uri="direct:start"/&gt;
+            &lt;to uri="mock:foo"/&gt;
+            &lt;to uri="[[result]]"/&gt;
         &lt;/route&gt;
     &lt;/camelContext&gt;
-&lt;/blueprint&gt;]]></script>
-</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">
-<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;
-  &lt;cm:default-properties&gt;
-    &lt;cm:property name=&quot;greeting&quot; value=&quot;Hello&quot;/&gt;
-    &lt;cm:property name=&quot;destination&quot; 
value=&quot;mock:result&quot;/&gt;
-  &lt;/cm:default-properties&gt;
-&lt;/cm:property-placeholder&gt;
-
-&lt;!-- a bean that uses a blueprint property placeholder --&gt;
-&lt;bean id=&quot;myCoolBean&quot; 
class=&quot;org.apache.camel.test.blueprint.MyCoolBean&quot;&gt;
-  &lt;property name=&quot;say&quot; value=&quot;${greeting}&quot;/&gt;
-&lt;/bean&gt;
-
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
-
-  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;bean ref=&quot;myCoolBean&quot; method=&quot;saySomething&quot;/&gt;
-    &lt;to uri=&quot;{{destination}}&quot;/&gt;
-  &lt;/route&gt;
-
-&lt;/camelContext&gt;
-]]></script>
-</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) {
-    // add the properties we want to override
-    props.put(&quot;greeting&quot;, &quot;Bye&quot;);
-
-    // return the PID of the config-admin we are using in the blueprint xml 
file
-    return &quot;my-placeholders&quot;;
-}
-]]></script>
-</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;
-
-&lt;!-- a bean that uses a blueprint property placeholder --&gt;
-&lt;bean id=&quot;myCoolBean&quot; 
class=&quot;org.apache.camel.test.blueprint.MyCoolBean&quot;&gt;
-  &lt;property name=&quot;say&quot; value=&quot;${greeting}&quot;/&gt;
-&lt;/bean&gt;
-
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
-
-  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;bean ref=&quot;myCoolBean&quot; method=&quot;saySomething&quot;/&gt;
-    &lt;to uri=&quot;mock:result&quot;/&gt;
-  &lt;/route&gt;
-
-&lt;/camelContext&gt;
-]]></script>
-</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() {
-    // String[0] = tell Camel the path of the .cfg file to use for OSGi 
ConfigAdmin in the blueprint XML file
-    // String[1] = tell Camel the persistence-id of the 
cm:property-placeholder in the blueprint XML file
-    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&#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
+&lt;/blueprint&gt;</plain-text-body><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><plain-text-body>location="blueprint:myblueprint.placeholder,classpath:myproperties.properties"
+</plain-text-body><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:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-outside.xml}</plain-text-body>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:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/cam
 
el-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminOverridePropertiesOutsideCamelContextTest.java}</plain-text-body>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>.<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfile.xml}</plain-text-body>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:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java}</plain-text-body>Notice
 that this me
 thod 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><plain-text-body>## this is a comment
 greeting=Bye
-]]></script>
-</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;
-           
xmlns:cm=&quot;http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0&quot;
-           xsi:schemaLocation=&quot;
-             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 
http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
-             http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;&gt;
-
-  &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;
-    &lt;cm:default-properties&gt;
-      &lt;cm:property name=&quot;greeting&quot; value=&quot;Hello&quot; /&gt;
-      &lt;cm:property name=&quot;echo&quot; value=&quot;Hey&quot; /&gt;
-      &lt;cm:property name=&quot;destination&quot; 
value=&quot;mock:original&quot; /&gt;
-    &lt;/cm:default-properties&gt;
-  &lt;/cm:property-placeholder&gt;
-
-  &lt;!-- a bean that uses a blueprint property placeholder --&gt;
-  &lt;bean id=&quot;myCoolBean&quot; 
class=&quot;org.apache.camel.test.blueprint.MyCoolBean&quot;&gt;
-    &lt;property name=&quot;say&quot; value=&quot;${greeting}&quot;/&gt;
-    &lt;property name=&quot;echo&quot; value=&quot;${echo}&quot;/&gt;
-  &lt;/bean&gt;
-
-  &lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
-
-    &lt;route&gt;
-      &lt;from uri=&quot;direct:start&quot;/&gt;
-      &lt;bean ref=&quot;myCoolBean&quot; method=&quot;saySomething&quot;/&gt;
-      &lt;to uri=&quot;{{destination}}&quot;/&gt;
-      &lt;bean ref=&quot;myCoolBean&quot; method=&quot;echoSomething&quot;/&gt;
-      &lt;to uri=&quot;{{destination}}&quot;/&gt;
-    &lt;/route&gt;
-
-  &lt;/camelContext&gt;
-
-&lt;/blueprint&gt;
-]]></script>
-</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
- * placeholders from this unit test source code directly (the change will 
reload blueprint container).
- */
-public class ConfigAdminLoadConfigurationFileAndOverrideTest extends 
CamelBlueprintTestSupport {
-
-    @Override
-    protected String getBlueprintDescriptor() {
-        // which blueprint XML file to use for this test
-        return 
&quot;org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml&quot;;
-    }
-
-    @Override
-    protected String[] loadConfigAdminConfigurationFile() {
-        // which .cfg file to use, and the name of the persistence-id
-        return new String[]{&quot;src/test/resources/etc/stuff.cfg&quot;, 
&quot;stuff&quot;};
-    }
-
-    @Override
-    protected String useOverridePropertiesWithConfigAdmin(Dictionary props) 
throws Exception {
-        // override / add extra properties
-        props.put(&quot;destination&quot;, &quot;mock:extra&quot;);
-
-        // return the persistence-id to use
-        return &quot;stuff&quot;;
-    }
-
-    @Test
-    public void testConfigAdmin() throws Exception {
-        // mock:original comes from 
&lt;cm:default-properties&gt;/&lt;cm:property name=&quot;destination&quot; 
value=&quot;mock:original&quot; /&gt;
-        getMockEndpoint(&quot;mock:original&quot;).setExpectedMessageCount(0);
-        // mock:result comes from loadConfigAdminConfigurationFile()
-        getMockEndpoint(&quot;mock:result&quot;).setExpectedMessageCount(0);
-        // mock:extra comes from useOverridePropertiesWithConfigAdmin()
-        
getMockEndpoint(&quot;mock:extra&quot;).expectedBodiesReceived(&quot;Bye 
World&quot;, &quot;Yay Bye WorldYay Bye World&quot;);
-
-        template.sendBody(&quot;direct:start&quot;, &quot;World&quot;);
-
-        assertMockEndpointsSatisfied();
-    }
-
-}
-]]></script>
-</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
+</plain-text-body><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:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml}</plain-text-body>And
 in the unit test class we do as 
follows:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java}</plain-text-body>And
 the <strong><code>etc/stuff.cfg</code></strong> configuration file 
contains:</p><plain-text-body>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 third-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;
-&lt;!-- you must NOT use the &lt;context:property-placeholder at the same 
time, only this bridge bean --&gt;
-&lt;bean id=&quot;bridgePropertyPlaceholder&quot; 
class=&quot;org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer&quot;&gt;
-  &lt;property name=&quot;location&quot; 
value=&quot;classpath:org/apache/camel/component/properties/cheese.properties&quot;/&gt;
-&lt;/bean&gt;
-
-]]></script>
-</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;
-&lt;!-- the ${hi} is a spring property placeholder --&gt;
-&lt;bean id=&quot;hello&quot; 
class=&quot;org.apache.camel.component.properties.HelloBean&quot;&gt;
-  &lt;property name=&quot;greeting&quot; value=&quot;${hi}&quot;/&gt;
-&lt;/bean&gt;
-
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;!-- in this route we use Camels property placeholder {{ }} style --&gt;
-  &lt;route&gt;
-    &lt;from uri=&quot;direct:{{cool.bar}}&quot;/&gt;
-    &lt;bean ref=&quot;hello&quot;/&gt;
-    &lt;to uri=&quot;{{cool.end}}&quot;/&gt;
-  &lt;/route&gt;
-&lt;/camelContext&gt;
-
-]]></script>
-</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;
+</plain-text-body><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 third-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:<plain-text-body>{snippet:id=e1|lang=xml|title=Bridging Spring and Camel 
property 
placeholders|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurerTest.xml}</plain-text-body>You
 <st
 rong>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:<plain-text-body>{snippet:id=e2|lang=xml|title=Using bridge 
property 
placeholders|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurerTest.xml}</plain-text-body>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><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;setHeader 
headerName="Exchange.FILE_NAME"&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&#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;
+</plain-text-body><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><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;setHeader 
headerName="Exchange.FILE_NAME"&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 
<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
-protected Properties useOverridePropertiesWithPropertiesComponent() {
-    Properties extra = new Properties();
-    extra.put(&quot;destination&quot;, &quot;mock:extra&quot;);
-    extra.put(&quot;greeting&quot;, &quot;Bye&quot;);
-    return extra;
-}
-]]></script>
-</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 {

[... 123 lines stripped ...]

Reply via email to