You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2016/03/17 15:19:36 UTC
svn commit: r983025 - in /websites/production/camel/content:
cache/main.pageCache spring-boot.html
Author: buildbot
Date: Thu Mar 17 14:19:35 2016
New Revision: 983025
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 Thu Mar 17 14:19:35 2016
@@ -92,7 +92,27 @@
<version>${camel.version}</version> <!-- use the same version as your Camel core version -->
</dependency>
]]></script>
-</div></div><p><code>camel-spring-boot</code> jar comes with the <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-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 auto-configuration creates <code>SpringCamelContext</code> for you and takes care of the proper initialization and shutdown of that context. Created Camel context is also registered in the Spring application context (under <code>camelContext</code> bean name), so you can access it just as the any other Spring bean.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p><code>camel-spring-boot</code> jar comes with the <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 <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/components/camel-spring-boot-starter/camel-spring-boot-sample" rel="nofollow">sample application</a> 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 clas
s="codeContent panelContent pdl">
+<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
+ <version>2.17.0</version>
+</dependency>]]></script>
+</div></div><p>Then you can just add classes with your Camel routes 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[package com.example;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MyRoute extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+ from("timer:foo").to("log:bar");
+ }
+}]]></script>
+</div></div><p>Then these routes will automatic be started.</p><p>You can customize the Camel application in the <code>application.properties</code> or <code>application.yml</code> file. </p><p> </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 auto-configuration creates <code>SpringCamelContext</code> for you and takes care of the proper initialization and shutdown of that context. Created Camel context is also registered in the Spring application context (under <code>camelContext</code> bean name), so you can access it just as the 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 {