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 2013/10/25 22:19:35 UTC

svn commit: r884111 - in /websites/production/camel/content: cache/main.pageCache spring-java-config.html

Author: buildbot
Date: Fri Oct 25 20:19:34 2013
New Revision: 884111

Log:
Production update by buildbot for camel

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

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

Modified: websites/production/camel/content/spring-java-config.html
==============================================================================
--- websites/production/camel/content/spring-java-config.html (original)
+++ websites/production/camel/content/spring-java-config.html Fri Oct 25 20:19:34 2013
@@ -111,7 +111,42 @@
 
 <p>Note that this library is totally optional; you could just wire Camel together yourself with Java Config.</p>
 
-<h3><a shape="rect" name="SpringJavaConfig-Example"></a>Example</h3>
+<h3><a shape="rect" name="SpringJavaConfig-Commoncases"></a>Common cases</h3>
+
+<p>The most common case of using JavaConfig with Camel would be to create configuration with defined list of routes to be used by router.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Configuration
+public class MyRouteConfiguration extends CamelConfiguration {
+
+    @Autowire
+    private MyRouteBuilder myRouteBuilder;
+
+    @Autowire
+    private MyAnotherRouteBuilder myAnotherRouteBuilder;
+
+    @Override
+    public List&lt;RouteBuilder&gt; routes() {
+        return Arrays.asList(myRouteBuilder, myAnotherRouteBuilder);
+    } 
+
+}
+]]></script>
+</div></div>
+
+<p>Starting from Camel 2.13.0 you can skip the <b>routes()</b> definition, and fall back to the <b>RouteBuilder</b> instances located in the Spring context.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Configuration
+@ComponentScan("com.example.routes")
+public class MyRouteConfiguration extends CamelConfiguration {
+}
+]]></script>
+</div></div>
+
+<h3><a shape="rect" name="SpringJavaConfig-Otherexamples"></a>Other examples</h3>
 
 <p>The following <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java">example using Java Config</a> is actually a <a shape="rect" href="spring-testing.html" title="Spring Testing">Spring Testing</a> based unit test.</p>
 
@@ -167,7 +202,7 @@ public class FilterTest extends Abstract
 
 <p>The <b>@ContextConfiguration</b> annotation tells the <a shape="rect" href="spring-testing.html" title="Spring Testing">Spring Testing</a> framework to load the <b>ContextConfig</b> class as the configuration to use. This class derives from <b>SingleRouteCamelConfiguration</b> which is a helper Spring Java Config class which will configure the CamelContext for us and then register the RouteBuilder we create.</p>
 
-<p>If you wish to create a collection of <b>RouteBuilder</b> instances then derive from the <b>CamelConfiguration</b> helper class and implement the <b>routes()</b> method.</p>
+<p>If you wish to create a collection of <b>RouteBuilder</b> instances then derive from the <b>CamelConfiguration</b> helper class and implement the <b>routes()</b> method. Keep in mind that (starting from the Camel 2.13.0) if you don't override <b>routes()</b> method, then <b>CamelConfiguration</b> will use all <b>RouteBuilder</b> instances available in the Spring context.</p>
 
 <p>Since <b>Camel 2.11.0</b> you can use the CamelSpringJUnit4ClassRunner with CamelSpringDelegatingTestContextLoader like <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java">example using Java Config with CamelSpringJUnit4ClassRunner</a>.<br clear="none">
 </p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">