diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-17 22:53:30 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-17 22:53:30 +0000 |
commit | 55b366b52798daae7baae5b2b118b95e188054d0 (patch) | |
tree | c8859e69f76fc9e1dec4e1d84a8d4a4803613dec /sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime | |
parent | 09befddffa67da83fc1e82285a4698043ea1f145 (diff) |
Use the same way to create application context
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@986515 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime')
-rw-r--r-- | sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java index d5a330c916..b3b18abbd4 100644 --- a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java +++ b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java @@ -33,7 +33,6 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.UrlResource; @@ -74,27 +73,20 @@ public class SpringContextTie { private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext, List<URL> resources) { - XmlBeanFactory beanFactory = null; - AbstractApplicationContext appContext = null; - - if (resources.size() > 1) { - GenericApplicationContext appCtx = - new SCAGenericApplicationContext(scaParentContext, implementation.getClassLoader()); - XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx); - for (URL resource : resources) { - xmlReader.loadBeanDefinitions(new UrlResource(resource)); - } - xmlReader.setBeanClassLoader(implementation.getClassLoader()); - includeAnnotationProcessors(appCtx.getBeanFactory()); - return appCtx; + GenericApplicationContext appCtx = + new SCAGenericApplicationContext(scaParentContext, implementation.getClassLoader()); + XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx); + + // REVIEW: [rfeng] How do we control the schema validation + xmlReader.setValidating(false); + + for (URL resource : resources) { + xmlReader.loadBeanDefinitions(new UrlResource(resource)); } + xmlReader.setBeanClassLoader(implementation.getClassLoader()); + includeAnnotationProcessors(appCtx.getBeanFactory()); + return appCtx; - // use the generic application context as default - beanFactory = new XmlBeanFactory(new UrlResource(resources.get(0))); - beanFactory.setBeanClassLoader(implementation.getClassLoader()); - includeAnnotationProcessors(beanFactory); - appContext = new SCAGenericApplicationContext(beanFactory, scaParentContext, implementation.getClassLoader()); - return appContext; } public Object getBean(String id) throws BeansException { |