You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/11/20 12:24:29 UTC
camel git commit: CAMEL-8048 Merged the registry of Main with thanks
to Alexey
Repository: camel
Updated Branches:
refs/heads/master 3e15ab8c5 -> 3d7174977
CAMEL-8048 Merged the registry of Main with thanks to Alexey
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3d717497
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3d717497
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3d717497
Branch: refs/heads/master
Commit: 3d7174977bdd12ebddab1050b8f481a69a0bd9f8
Parents: 3e15ab8
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Nov 20 19:24:06 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Nov 20 19:24:06 2014 +0800
----------------------------------------------------------------------
camel-core/src/main/java/org/apache/camel/main/Main.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3d717497/camel-core/src/main/java/org/apache/camel/main/Main.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/main/Main.java b/camel-core/src/main/java/org/apache/camel/main/Main.java
index 85d516e..e674c18 100644
--- a/camel-core/src/main/java/org/apache/camel/main/Main.java
+++ b/camel-core/src/main/java/org/apache/camel/main/Main.java
@@ -18,10 +18,12 @@ package org.apache.camel.main;
import java.util.HashMap;
import java.util.Map;
+
import javax.xml.bind.JAXBException;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
+import org.apache.camel.impl.CompositeRegistry;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.SimpleRegistry;
import org.apache.camel.spi.Registry;
@@ -133,7 +135,12 @@ public class Main extends MainSupport {
if (registry.size() > 0) {
// set the registry through which we've already bound some beans
if (DefaultCamelContext.class.isAssignableFrom(camelContext.getClass())) {
- ((DefaultCamelContext) camelContext).setRegistry(registry);
+ CompositeRegistry compositeRegistry = new CompositeRegistry();
+ // make sure camel look up the Object from the registry first
+ compositeRegistry.addRegistry(registry);
+ // use the camel old registry as a fallback
+ compositeRegistry.addRegistry(((DefaultCamelContext) camelContext).getRegistry());
+ ((DefaultCamelContext) camelContext).setRegistry(compositeRegistry);
}
}