You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/03/17 14:34:05 UTC

camel git commit: CAMEL-9719: Camel Spring Boot Starter. Lets use web in sample as most people would use that.

Repository: camel
Updated Branches:
  refs/heads/master 7c05e621f -> 1c43375c4


CAMEL-9719: Camel Spring Boot Starter. Lets use web in sample as most people would use that.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1c43375c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1c43375c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1c43375c

Branch: refs/heads/master
Commit: 1c43375c411b4a132b1f95cb01cdf9ac0f736070
Parents: 7c05e62
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Mar 17 14:33:55 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Mar 17 14:33:55 2016 +0100

----------------------------------------------------------------------
 .../camel-spring-boot-sample/pom.xml            | 14 ++++++++-
 .../sample/camel/SampleCamelApplication.java    |  6 ++--
 .../src/main/resources/application.properties   |  4 ---
 .../camel/SampleCamelApplicationTest.java       |  2 --
 .../boot/CamelConfigurationProperties.java      | 30 +++++++++++---------
 5 files changed, 31 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1c43375c/components/camel-spring-boot-starter/camel-spring-boot-sample/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot-starter/camel-spring-boot-sample/pom.xml b/components/camel-spring-boot-starter/camel-spring-boot-sample/pom.xml
index 48df175..583da36 100644
--- a/components/camel-spring-boot-starter/camel-spring-boot-sample/pom.xml
+++ b/components/camel-spring-boot-starter/camel-spring-boot-sample/pom.xml
@@ -56,21 +56,33 @@
 
   <dependencies>
 
+    <!-- spring-web -->
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-web</artifactId>
+    </dependency>
+
+    <!-- camel -->
     <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-spring-boot-starter</artifactId>
     </dependency>
-
     <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-stream</artifactId>
     </dependency>
 
+    <!-- test -->
     <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-test</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
 
   </dependencies>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1c43375c/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/java/sample/camel/SampleCamelApplication.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/java/sample/camel/SampleCamelApplication.java b/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/java/sample/camel/SampleCamelApplication.java
index e90caf3..6c6c9ef 100644
--- a/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/java/sample/camel/SampleCamelApplication.java
+++ b/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/java/sample/camel/SampleCamelApplication.java
@@ -16,13 +16,11 @@
  */
 package sample.camel;
 
+import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
 
 /**
  * A sample Spring Boot application that starts the Camel routes.
- * <p/>
- * See the <tt>application.properties</tt> where the
  */
 @SpringBootApplication
 public class SampleCamelApplication {
@@ -31,7 +29,7 @@ public class SampleCamelApplication {
      * A main method to start this application.
      */
     public static void main(String[] args) {
-        new SpringApplicationBuilder().sources(SampleCamelApplication.class).run(args);
+        SpringApplication.run(SampleCamelApplication.class, args);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/1c43375c/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/resources/application.properties
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/resources/application.properties b/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/resources/application.properties
index ab11489..1d32a64 100644
--- a/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/resources/application.properties
+++ b/components/camel-spring-boot-starter/camel-spring-boot-sample/src/main/resources/application.properties
@@ -18,10 +18,6 @@
 # the name of Camel
 camel.springboot.name = SampleCamel
 
-# we want the main thread to keep running
-camel.springboot.main-run-controller = true
-
-
 # properties used in the Camel route and beans
 # --------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1c43375c/components/camel-spring-boot-starter/camel-spring-boot-sample/src/test/java/sample/camel/SampleCamelApplicationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot-starter/camel-spring-boot-sample/src/test/java/sample/camel/SampleCamelApplicationTest.java b/components/camel-spring-boot-starter/camel-spring-boot-sample/src/test/java/sample/camel/SampleCamelApplicationTest.java
index 501f7ac..e5a097c 100644
--- a/components/camel-spring-boot-starter/camel-spring-boot-sample/src/test/java/sample/camel/SampleCamelApplicationTest.java
+++ b/components/camel-spring-boot-starter/camel-spring-boot-sample/src/test/java/sample/camel/SampleCamelApplicationTest.java
@@ -23,7 +23,6 @@ import org.apache.camel.builder.NotifyBuilder;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.IntegrationTest;
 import org.springframework.boot.test.SpringApplicationConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
@@ -31,7 +30,6 @@ import static org.junit.Assert.assertTrue;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @SpringApplicationConfiguration(SampleCamelApplication.class)
-@IntegrationTest("camel.springboot.main-run-controller=false")
 public class SampleCamelApplicationTest {
 
     @Autowired

http://git-wip-us.apache.org/repos/asf/camel/blob/1c43375c/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
index 41b90df..fe2f1fc 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
@@ -24,7 +24,12 @@ public class CamelConfigurationProperties {
     // Properties
 
     /**
-     * Enable JMX support for the CamelContext.
+     * Sets the name of the CamelContext.
+     */
+    private String name;
+
+    /**
+     * Enable JMX in your Camel application.
      */
     private boolean jmxEnabled = true;
 
@@ -44,11 +49,6 @@ public class CamelConfigurationProperties {
     private boolean typeConversion = true;
 
     /**
-     * Sets the name of the this CamelContext.
-     */
-    private String name;
-
-    /**
      * Directory to scan for adding additional XML routes.
      * You can turn this off by setting the value to <tt>false</tt>
      */
@@ -63,11 +63,21 @@ public class CamelConfigurationProperties {
     /**
      * Whether to use the main run controller to ensure the Spring-Boot application
      * keeps running until being stopped or the JVM terminated.
+     * You typically only need this if you run Spring-Boot standalone.
+     * If you run Spring-Boot with spring-boot-starter-web then the web container keeps the JVM running.
      */
     private boolean mainRunController;
 
     // Getters & setters
 
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
     public boolean isJmxEnabled() {
         return jmxEnabled;
     }
@@ -100,14 +110,6 @@ public class CamelConfigurationProperties {
         this.typeConversion = typeConversion;
     }
 
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
     public String getXmlRoutes() {
         return xmlRoutes;
     }