<html>
<head>
<base href="http://cwiki.apache.org/confluence">
<link rel="stylesheet" href="/confluence/s/1810/9/13/_/styles/combined.css?spaceKey=SM&forWysiwyg=true"
type="text/css">
</head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
<h2><a href="http://cwiki.apache.org/confluence/display/SM/4.+Beginner+-+Outsource+SU+configuration+in+a+properties+file">4.
Beginner - Outsource SU configuration in a properties file</a></h2>
<h4>Page <b>edited</b> by <a href="http://cwiki.apache.org/confluence/display/~ccustine">Chris
Custine</a>
</h4>
<br/>
<h4>Changes (1)</h4>
<div id="page-diffs">
<table class="diff" cellpadding="0" cellspacing="0">
<tr><td class="diff-snipped" >...<br></td></tr>
<tr><td class="diff-unchanged" >The HTTP SU xbean.xml looks like this
: <br> <br></td></tr>
<tr><td class="diff-changed-lines" ><span class="diff-changed-words">{newcode:<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">language=</span>xml|title=xbean.xml|controls=true|linenumbers=true|theme=Default}</span>
<br></td></tr>
<tr><td class="diff-unchanged" ><beans xmlns:http="http://servicemix.apache.org/http/1.0"
xmlns:myService="http://www.example.com/myService"> <br> <br></td></tr>
<tr><td class="diff-snipped" >...<br></td></tr>
</table>
</div> <h4>Full Content</h4>
<div class="notificationGreySide">
<style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}
/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/SM/3.+Beginner+-+Using+Apache+Camel+inside+ServiceMix"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/SM/3.+Beginner+-+Using+Apache+Camel+inside+ServiceMix">3.
Beginner - Using Apache Camel inside ServiceMix</a> </td><td width='33%'
class='ScrollbarParent'><sup><a href="/confluence/display/SM/Tutorials"><img
border='0' align='middle' src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/SM/Tutorials">Tutorials</a></td><td width='33%'
class='ScrollbarNextName'> <a href="/confluence/display/SM/6.+Intermediate+-+Using+EJB+inside+ServiceMix">6.
Intermediate - Using EJB inside ServiceMix</a></td><td class='ScrollbarNextIcon'><a
href="/confluence/display/SM/6.+Intermediate+-+Using+EJB+inside+ServiceMix"><img border='0'
align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>
<h1><a name="4.Beginner-OutsourceSUconfigurationinapropertiesfile-4.BeginnerOutsourceSUconfigurationinapropertiesfile"></a>4.
Beginner - Outsource SU configuration in a properties file</h1>
<p>This tutorial teaches you how to externalize SU configuration in a dedicated properties
file (on a special location or in the ServiceMix classpath).</p>
<p>Using this, you are able to change the service configuration without rebuilding your
SU (just a service restart is required).</p>
<p>To do it, we use a Spring PropertyPlaceholderConfigurer.</p>
<p>Here is an example of it in a HTTP SU.</p>
<p>The HTTP SU xbean.xml looks like this :</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>xbean.xml</b></div><div class="codeContent
panelContent">
<script type="syntaxhighlighter" class="toolbar: true; theme: Default; brush: xml; gutter:
true"><![CDATA[
<beans xmlns:http="http://servicemix.apache.org/http/1.0" xmlns:myService="http://www.example.com/myService">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:/myService.properties</value>
</property>
</bean>
<http:consumer service="myService"
endpoint="my-service-http-consumer"
locationURI="${service.locationURI}"/>
</beans>
]]></script>
</div></div>
<p>You can see that the HTTP locationURI uses </p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>${service.locationURI}</pre>
</div></div>
<p> contained in the myService.properties (located in the ServiceMix classpath).</p>
<p>The myService.properties file simply contains :</p>
<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader
panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>myService.properties</b></div><div
class="codeContent panelContent">
<pre class="code-none">
service.locationURI=http://0.0.0.0:8081/myService
</pre>
</div></div>
</div>
<div id="commentsSection" class="wiki-content pageSection">
<div style="float: right;">
<a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
</div>
<a href="http://cwiki.apache.org/confluence/display/SM/4.+Beginner+-+Outsource+SU+configuration+in+a+properties+file">View
Online</a>
|
<a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=103486&revisedVersion=12&originalVersion=11">View
Changes</a>
|
<a href="http://cwiki.apache.org/confluence/display/SM/4.+Beginner+-+Outsource+SU+configuration+in+a+properties+file?showComments=true&showCommentArea=true#addcomment">Add
Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
|