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:26 UTC
[2/2] git commit: CAMEL-7657: SpringRouteBuilder should use
getBean(type) when lookup by type.
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);
}
/**