You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by he...@apache.org on 2014/11/06 10:21:47 UTC
git commit: [Spring Boot] Tuned configuration callback execution
order.
Repository: camel
Updated Branches:
refs/heads/master 7c865cfc0 -> 8737a39d1
[Spring Boot] Tuned configuration callback execution order.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8737a39d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8737a39d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8737a39d
Branch: refs/heads/master
Commit: 8737a39d18604199b88fc2ad6b6551affe34342d
Parents: 7c865cf
Author: Henryk Konsek <he...@gmail.com>
Authored: Thu Nov 6 10:21:40 2014 +0100
Committer: Henryk Konsek <he...@gmail.com>
Committed: Thu Nov 6 10:21:40 2014 +0100
----------------------------------------------------------------------
.../org/apache/camel/spring/boot/CamelAutoConfiguration.java | 7 -------
.../apache/camel/spring/boot/CamelContextConfiguration.java | 2 +-
.../java/org/apache/camel/spring/boot/RoutesCollector.java | 8 ++++++++
.../apache/camel/spring/boot/CamelAutoConfigurationTest.java | 2 +-
4 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8737a39d/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
index c7b6b93..9bf17db 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
@@ -110,9 +110,6 @@ public class CamelAutoConfiguration {
@Autowired
private ApplicationContext applicationContext;
- @Autowired(required = false)
- private CamelContextConfiguration camelContextConfiguration;
-
/**
* Spring-aware Camel context for the application. Auto-detects and loads all routes available in the Spring
* context.
@@ -125,10 +122,6 @@ public class CamelAutoConfiguration {
camelContext.disableJMX();
}
- if (camelContextConfiguration != null) {
- camelContextConfiguration.beforeStart(camelContext);
- }
-
return camelContext;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/8737a39d/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelContextConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelContextConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelContextConfiguration.java
index ebdf4aa..418cb00 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelContextConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelContextConfiguration.java
@@ -20,6 +20,6 @@ import org.apache.camel.CamelContext;
public interface CamelContextConfiguration {
- void beforeStart(CamelContext camelContext);
+ void beforeApplicationStart(CamelContext camelContext);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/8737a39d/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
index 09f69ab..40e6f1a 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
@@ -21,6 +21,7 @@ import org.apache.camel.RoutesBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -31,6 +32,9 @@ public class RoutesCollector implements BeanPostProcessor, ApplicationContextAwa
private ApplicationContext applicationContext;
+ @Autowired(required = false)
+ private CamelContextConfiguration camelContextConfiguration;
+
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
return bean;
@@ -49,6 +53,10 @@ public class RoutesCollector implements BeanPostProcessor, ApplicationContextAwa
throw new RuntimeException(e);
}
}
+ if (camelContextConfiguration != null) {
+ LOG.debug("CamelContextConfiguration found. Invoking: {}", camelContextConfiguration);
+ camelContextConfiguration.beforeApplicationStart(camelContext);
+ }
}
return bean;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/8737a39d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
index 6538539..e4f6572 100644
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
@@ -125,7 +125,7 @@ public class CamelAutoConfigurationTest extends Assert {
@Test
public void shouldCallCamelContextConfiguration() {
- verify(camelContextConfiguration).beforeStart(camelContext);
+ verify(camelContextConfiguration).beforeApplicationStart(camelContext);
}
@Test