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 2014/08/04 15:28:25 UTC

[1/2] git commit: CAMEL-7657: SpringRouteBuilder should use getBean(type) when lookup by type.

Repository: camel
Updated Branches:
  refs/heads/camel-2.13.x 8f83f6185 -> 7086096da
  refs/heads/master e146d0f9f -> 1be89fe5c


CAMEL-7657: SpringRouteBuilder should use getBean(type) when lookup by type.


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

Branch: refs/heads/master
Commit: 1be89fe5c360b4e677eddbe358815a4fa522f1f5
Parents: e146d0f
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Aug 4 15:27:15 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Aug 4 15:27:15 2014 +0200

----------------------------------------------------------------------
 .../org/apache/camel/spring/SpringRouteBuilder.java     | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1be89fe5/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
index 5800046..1813ade 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
@@ -58,17 +58,7 @@ public abstract class SpringRouteBuilder extends RouteBuilder implements Applica
      */
     public <T> T lookup(Class<T> type) {
         ApplicationContext context = getApplicationContext();
-        String[] names = context.getBeanNamesForType(type, true, true);
-        if (names != null) {
-            int count = names.length;
-            if (count == 1) {
-                // lets instantiate the single bean
-                return context.getBean(names[0], type);
-            } else if (count > 1) {
-                throw new IllegalArgumentException("Too many beans in the application context of type: " + type + ". Found: " + count);
-            }
-        }
-        throw new IllegalArgumentException("No bean available in the application context of type: " + type);
+        return context.getBean(type);
     }
 
     /**


[2/2] git commit: CAMEL-7657: SpringRouteBuilder should use getBean(type) when lookup by type.

Posted by da...@apache.org.
CAMEL-7657: SpringRouteBuilder should use getBean(type) when lookup by type.


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

Branch: refs/heads/camel-2.13.x
Commit: 7086096da2ea32603815d084e2e81ceefeb5f775
Parents: 8f83f61
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Aug 4 15:27:15 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Aug 4 15:28:14 2014 +0200

----------------------------------------------------------------------
 .../org/apache/camel/spring/SpringRouteBuilder.java     | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7086096d/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
index 5800046..1813ade 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
@@ -58,17 +58,7 @@ public abstract class SpringRouteBuilder extends RouteBuilder implements Applica
      */
     public <T> T lookup(Class<T> type) {
         ApplicationContext context = getApplicationContext();
-        String[] names = context.getBeanNamesForType(type, true, true);
-        if (names != null) {
-            int count = names.length;
-            if (count == 1) {
-                // lets instantiate the single bean
-                return context.getBean(names[0], type);
-            } else if (count > 1) {
-                throw new IllegalArgumentException("Too many beans in the application context of type: " + type + ". Found: " + count);
-            }
-        }
-        throw new IllegalArgumentException("No bean available in the application context of type: " + type);
+        return context.getBean(type);
     }
 
     /**