diff options
author | ramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-30 11:13:48 +0000 |
---|---|---|
committer | ramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-30 11:13:48 +0000 |
commit | e48a541b03281411d1780cd860043ca0499fe198 (patch) | |
tree | 1a4f670f3246adcb2d88851a722083ccff56e450 /branches/sca-java-1.x/modules/implementation-spring-runtime/src/main | |
parent | 4b8f6c020fd9ad60d55a9644b568a7bd8fa89bfd (diff) |
Fixes in 1.x for TUSCANY-3069
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@789681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/implementation-spring-runtime/src/main')
2 files changed, 22 insertions, 7 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java index 2cd60d201f..94556eae57 100644 --- a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java +++ b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java @@ -88,6 +88,7 @@ public class SpringContextTie { private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext, URL resource) {
XmlBeanFactory beanFactory = new XmlBeanFactory(new UrlResource(resource));
+ beanFactory.setBeanClassLoader(implementation.getClassLoader());
AbstractApplicationContext appContext = null;
for (String bean : beanFactory.getBeanDefinitionNames()) {
@@ -123,8 +124,9 @@ public class SpringContextTie { }
}
- appContext = new ClassPathXmlApplicationContext(listValues, false, scaParentContext);
+ appContext = new ClassPathXmlApplicationContext(listValues, false, scaParentContext);
appContext.refresh();
+ appContext.getBeanFactory().setBeanClassLoader(implementation.getClassLoader());
if (isAnnotationSupported)
includeAnnotationProcessors(appContext.getBeanFactory());
return appContext;
@@ -135,6 +137,7 @@ public class SpringContextTie { if (isAnnotationSupported)
includeAnnotationProcessors(beanFactory);
appContext = new GenericApplicationContext(beanFactory, scaParentContext);
+ appContext.setClassLoader(implementation.getClassLoader());
return appContext;
}
diff --git a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java index 3139c9c500..b123be8b5c 100644 --- a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java +++ b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package org.apache.tuscany.sca.implementation.spring.runtime.context;
@@ -29,7 +29,7 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException; * It enables the Spring code in the runtime module to invoke methods on a
* Tuscany SpringImplementation without the Spring runtime module
* needing to know about any Tuscany classes. See the SpringImplementationTie class
- * in the implementation-spring module for what the tie does.
+ * in the implementation-spring module for what the tie does.
*/
public class SpringImplementationStub {
@@ -39,7 +39,8 @@ public class SpringImplementationStub { Method getComponentName;
Method getComponentTie;
Method getPropertyValueTie;
-
+ Method getClassLoader;
+
public SpringImplementationStub(Object tie) {
this.tie = tie;
Class<?> tieClass = tie.getClass();
@@ -49,11 +50,12 @@ public class SpringImplementationStub { getComponentName = tieClass.getMethod("getComponentName");
getComponentTie = tieClass.getMethod("getComponentTie");
getPropertyValueTie = tieClass.getMethod("getPropertyValueTie");
+ getClassLoader = tieClass.getMethod("getClassLoader");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
-
+
public String getURI() {
try {
@@ -114,4 +116,14 @@ public class SpringImplementationStub { throw new RuntimeException(e);
}
}
+
+ public ClassLoader getClassLoader() {
+ try {
+
+ return (ClassLoader) getClassLoader.invoke(tie);
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
}
|