camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r983116 - in /websites/production/camel/content: cache/main.pageCache spring-boot.html
Date Fri, 18 Mar 2016 14:18:37 GMT
Author: buildbot
Date: Fri Mar 18 14:18:36 2016
New Revision: 983116

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/spring-boot.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/spring-boot.html
==============================================================================
--- websites/production/camel/content/spring-boot.html (original)
+++ websites/production/camel/content/spring-boot.html Fri Mar 18 14:18:36 2016
@@ -85,14 +85,14 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="SpringBoot-SpringBoot">Spring Boot</h2><p><strong>Available
as of Camel 2.15</strong></p><p><span style="line-height: 1.4285715;">Spring
Boot component provide auto-configuration for the Apache Camel.&#160;Our opinionated auto-configuration
of the Camel context auto-detects Camel routes available in the Spring context and&#160;registers
the key Camel utilities (like producer template, consumer template and the type converter)
as beans.</span></p><p><span style="line-height: 1.4285715;">Maven
users will need to add the following dependency to their </span><code style="line-height:
1.4285715;">pom.xml</code><span style="line-height: 1.4285715;"> for this component:</span></p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<div class="wiki-content maincontent"><h2 id="SpringBoot-SpringBoot">Spring Boot</h2><p><strong>Available
as of Camel 2.15</strong></p><p><span style="line-height: 1.4285715;">Spring
Boot component provides auto-configuration for Apache Camel.&#160;Our opinionated auto-configuration
of the Camel context auto-detects Camel routes available in the Spring context and&#160;registers
the key Camel utilities (like producer template, consumer template and the type converter)
as beans.</span></p><p><span style="line-height: 1.4285715;">Maven
users will need to add the following dependency to their </span><code style="line-height:
1.4285715;">pom.xml</code><span style="line-height: 1.4285715;"> for this component:</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;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-spring-boot&lt;/artifactId&gt;
     &lt;version&gt;${camel.version}&lt;/version&gt; &lt;!-- use the same
version as your Camel core version --&gt;
 &lt;/dependency&gt;
 ]]></script>
-</div></div><p><code>camel-spring-boot</code> jar comes with
the&#160;<code>spring.factories</code> file, so as soon as you add that dependency
into your classpath, Spring Boot will automatically auto-configure the Camel for you.</p><h3
id="SpringBoot-CamelSpringBootStarter">Camel Spring Boot Starter</h3><p><strong>Available
as of Camel 2.17</strong></p><p>Apache Camel ships a&#160;<a shape="rect"
class="external-link" href="https://github.com/spring-projects/spring-boot/tree/master/spring-boot-starters"
rel="nofollow">Spring Boot Starer</a> module that allows you to develop Spring Boot
applications using starter's. There is a <a shape="rect" class="external-link" href="https://github.com/apache/camel/tree/master/examples/camel-example-spring-boot-starter"
rel="nofollow">sample application</a>&#160;in the source code also.</p><p>To
use the starter add the following to your spring boot pom.xml file</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent pane
 lContent pdl">
+</div></div><p><code>camel-spring-boot</code> jar comes with
the&#160;<code>spring.factories</code> file, so as soon as you add that dependency
into your classpath, Spring Boot will automatically auto-configure Camel for you.</p><h3
id="SpringBoot-CamelSpringBootStarter">Camel Spring Boot Starter</h3><p><strong>Available
as of Camel 2.17</strong></p><p>Apache Camel ships a&#160;<a shape="rect"
class="external-link" href="https://github.com/spring-projects/spring-boot/tree/master/spring-boot-starters"
rel="nofollow">Spring Boot Starter</a> module that allows you to develop Spring Boot
applications using starter's. There is a <a shape="rect" class="external-link" href="https://github.com/apache/camel/tree/master/examples/camel-example-spring-boot-starter"
rel="nofollow">sample application</a>&#160;in the source code also.</p><p>To
use the starter add the following to your spring boot pom.xml file</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelCo
 ntent pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
  &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
  &lt;artifactId&gt;camel-spring-boot-starter&lt;/artifactId&gt;
@@ -112,7 +112,7 @@ public class MyRoute extends RouteBuilde
         from(&quot;timer:foo&quot;).to(&quot;log:bar&quot;);
     }
 }]]></script>
-</div></div><p>Then these routes will automatic be started.</p><p>You
can customize the Camel application in the&#160;<code>application.properties</code>
or&#160;<code>application.yml</code> file.&#160;</p><p>&#160;</p><h3
id="SpringBoot-Auto-configuredCamelcontext"><span style="line-height: 1.5625;">Auto-configured
Camel context</span></h3><p>The most important piece of functionality provided
by the Camel auto-configuration is <code>CamelContext</code> instance. Camel&#160;auto-configuration&#160;creates
<code>SpringCamelContext</code> for you and takes care of the proper initialization
and shutdown of that context. Created&#160;Camel context is also registered in the Spring
application context (under <code>camelContext</code> bean name), so you can access
it just&#160;as the any other Spring bean.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Then these routes will automatic be started.</p><p>You
can customize the Camel application in the&#160;<code>application.properties</code>
or&#160;<code>application.yml</code> file.&#160;</p><p>&#160;</p><h3
id="SpringBoot-Auto-configuredCamelcontext"><span style="line-height: 1.5625;">Auto-configured
Camel context</span></h3><p>The most important piece of functionality provided
by the Camel auto-configuration is <code>CamelContext</code> instance. Camel&#160;auto-configuration&#160;creates
<code>SpringCamelContext</code> for you and takes care of the proper initialization
and shutdown of that context. The created&#160;Camel context is also registered in the
Spring application context (under <code>camelContext</code> bean name), so you
can access it just&#160;as &#160;any other Spring bean.</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[@Configuration
 public class MyAppConfig {
 
@@ -125,7 +125,7 @@ public class MyAppConfig {
   }
 
 }]]></script>
-</div></div><h3 id="SpringBoot-Auto-detectingCamelroutes">Auto-detecting
Camel routes</h3><p>Camel auto-configuration collects all the <code>RoutesBuilder</code>
instances from the Spring context and automatically injects&#160;them into the provided
<code>CamelContext</code>. It means that creating new Camel route with the Spring
Boot starter is as simple as&#160;adding the <code>@Component</code> annotated
class into your classpath:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</div></div><h3 id="SpringBoot-Auto-detectingCamelroutes">Auto-detecting
Camel routes</h3><p>Camel auto-configuration collects all the <code>RouteBuilder</code>
instances from the Spring context and automatically injects&#160;them into the provided
<code>CamelContext</code>. It means that creating new Camel route with the Spring
Boot starter is as simple as&#160;adding the <code>@Component</code> annotated
class into your classpath:</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[@Component
 public class MyRouter extends RouteBuilder {
 
@@ -135,7 +135,7 @@ public class MyRouter extends RouteBuild
   }
 
 }]]></script>
-</div></div><p><br clear="none">...or creating new route <code>RoutesBuilder</code>&#160;bean
in your <code>@Configuration</code> class:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p><br clear="none">...or creating a new route <code>RouteBuilder</code>&#160;bean
in your <code>@Configuration</code> class:</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[@Configuration
 public class MyRouterConfiguration {
 
@@ -152,7 +152,7 @@ public class MyRouterConfiguration {
   }
  
 }]]></script>
-</div></div><h3 id="SpringBoot-Camelproperties">Camel properties</h3><p>Spring
Boot auto-configuration automatically connect <a shape="rect" class="external-link" href="http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config"
rel="nofollow">Spring Boot external configuration</a>&#160;(like properties placeholders,
<span>OS environment variables or system properties) with the&#160;<a shape="rect"
href="properties.html">Camel properties support</a>.</span>&#160;It basically
means that any property defined in <code>application.properties</code> file: &#160;</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><h3 id="SpringBoot-Camelproperties">Camel properties</h3><p>Spring
Boot auto-configuration automatically connects to&#160;<a shape="rect" class="external-link"
href="http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config"
rel="nofollow">Spring Boot external configuration</a>&#160;(like properties placeholders,
<span>OS environment variables or system properties) with the&#160;<a shape="rect"
href="properties.html">Camel properties support</a>.</span>&#160;It basically
means that any property defined in <code>application.properties</code> file: &#160;</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[route.from
= jms:invoices]]></script>
 </div></div><p>...or set via system property...</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[java
-Droute.to=jms:processed.invoices -jar mySpringApp.jar]]></script>
@@ -217,7 +217,7 @@ public class InvoiceProcessor {
   }
 
 }]]></script>
-</div></div><h3 id="SpringBoot-SpringtypeconversionAPIbridge">Spring type
conversion API bridge</h3><p>Spring comes with the&#160;powerful&#160;<a
shape="rect" class="external-link" href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/validation.html#core-convert"
rel="nofollow">type conversion API</a>. Spring API happens not to be much different
from the Camel <a shape="rect" href="type-converter.html">type converter API</a>.
As those APIs are so similar, Camel Spring Boot automatically registers bridge converter (<code>SpringTypeConverter</code>)
that delegates to the Spring conversion API. It basically means that out-of-the-box Camel
will threat Spring Converters as Camel ones. With this approach you can enjoy both Camel and
Spring converters accessed via Camel <code>TypeConverter</code>&#160;API:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><h3 id="SpringBoot-SpringtypeconversionAPIbridge">Spring type
conversion API bridge</h3><p>Spring comes with the&#160;powerful&#160;<a
shape="rect" class="external-link" href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/validation.html#core-convert"
rel="nofollow">type conversion API</a>. Spring API happens not to be much different
from the Camel <a shape="rect" href="type-converter.html">type converter API</a>.
As those APIs are so similar, Camel Spring Boot automatically registers bridge converter (<code>SpringTypeConverter</code>)
that delegates to the Spring conversion API. It basically means that out-of-the-box Camel
will treat Spring Converters as Camel ones. With this approach you can enjoy both Camel and
Spring converters accessed via Camel <code>TypeConverter</code>&#160;API:</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[@Component
 public class InvoiceProcessor {
 
@@ -284,7 +284,7 @@ public class MyFatJarRouterWarInitialize
   }
 
 }]]></script>
-</div></div><h3 id="SpringBoot-Blockingmainthread">Blocking main thread</h3><p>This
feature is available starting from the Camel <strong>2.15.2</strong>. Camel applications
extending FatJarRouter by default&#160;block the main thread of the application. It means
that after you start your fat jar, your application waits for Ctrl+C signal and doesn't exit
immediately. If you would like to achieve similar behavior for non-<code>FatJarRouter</code>
applications, retrieve&#160;<code><span style="line-height: 1.4285715;">CamelSpringBootApplicationController
</span></code><span style="line-height: 1.4285715;">bean from your <code>ApplicationContext</code>
and use the former to block the main thread of your application using <span><code>CamelSpringBootApplicationController#blockMainThread()</code>
method</span>.</span></p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="SpringBoot-Blockingmainthread">Blocking main thread</h3><p>This
feature is available starting from Camel <strong>2.15.2</strong>. Camel applications
extending FatJarRouter by default&#160;block the main thread of the application. It means
that after you start your fat jar, your application waits for Ctrl+C signal and does not exit
immediately. If you would like to achieve similar behavior for non-<code>FatJarRouter</code>
applications, retrieve&#160;<code><span style="line-height: 1.4285715;">CamelSpringBootApplicationController
</span></code><span style="line-height: 1.4285715;">bean from your <code>ApplicationContext</code>
and use the former to block the main thread of your application using <span><code>CamelSpringBootApplicationController#blockMainThread()</code>
method</span>.</span></p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[public
static void main(String... args) {
     ApplicationContext applicationContext = new SpringApplication(MyCamelApplication.class).run(args);
     CamelSpringBootApplicationController applicationController =



Mime
View raw message