From ac3a63c3aa963e3a50ecea543765fd6cfb154c57 Mon Sep 17 00:00:00 2001 From: antelder Date: Fri, 7 Sep 2012 10:00:21 +0000 Subject: TUSCANY-4069: Apply patch from Rashmi Hunt to fix Issue with resolving autowired reference when binding is not defined to a target service exposed over multiple bindings git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1381971 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/core/runtime/impl/EndpointReferenceBinderImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sca-java-2.x') diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java index 647cd12a32..4ce163f389 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java @@ -493,6 +493,16 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { } } } + + // TUSCANY-4069 if no binding specified on reference then use service binding.sca if that exists + if (endpointReference.getBinding() == null && endpointReference.getReference().getAutowire() == true){ + for (Endpoint endpoint : matchedEndpoints){ + if (endpoint.getBinding() instanceof SCABinding){ + matchedEndpoint = endpoint; + break; + } + } + } if (matchedEndpoint == null) { // just take the first matched endpoint from the list -- cgit v1.2.3