package de.incompleteco.spring.context; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationContext; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.DefaultResourceLoader; public class ApplicationContextClassLoader { public ClassLoader getClassLoader(String location) throws Exception { File f = new File(location); return new URLClassLoader(new URL[]{f.toURI().toURL()}); } public ApplicationContext getContext(String location,String... contextPaths) throws Exception { return getContext(null,location,contextPaths); } public ApplicationContext getContext(ApplicationContext parentContext,String location,String... contextPaths) throws Exception { //init GenericApplicationContext context = new GenericApplicationContext(); //build the app context if (parentContext != null) { context = new GenericApplicationContext(parentContext); }//end if XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context); //get the classloader ClassLoader loader = getClassLoader(location); //set the loader reader.setBeanClassLoader(loader); reader.setResourceLoader(new DefaultResourceLoader(loader)); //get the bean definitions reader.loadBeanDefinitions(contextPaths); //init context.refresh(); //return return context; } }
相关推荐
Manage Multiple Instances of OSPF with SNMP Contexts [IP Application Services] - Cisco Systems
Chapter 1: Architecting Your Application with Spring, Hibernate, and Patterns Chapter 2: Spring Basics Chapter 3: Basic Application Setup Chapter 4: Persistence with Hibernate Chapter 5: Domain Model ...
You'll gain an understanding of how application architectures have evolved from monoliths to microservices and be able to build your own microservices using Spring Boot. Complete with real-world ...
Matching with Shape Contexts,介绍如何将形状上下文用于图像匹配
the embeddings, multiple contexts can be adopted. However, these contexts are heterogeneous and often partially observed in practical tasks, imposing significant challenges to capture the overall ...
16. Bean 工厂和 Application contexts 有什么区别? 17. 一个 Spring 的应用看起来象什么? 18. 什么是 Spring 的依赖注入? 19. 有哪些不同类型的 IOC(依赖注入)方式? 20. 哪种依赖注入方式你建议使用,构造...
contexts应用工具-原版,让mac 支持完整的快捷栏,超级酸爽
spring-webflow-reference Spring Web Flow 2 Reference Guide Reference Documentation Keith Donald, SpringSource Erwin Vervaet, Ervacon Jeremy Grelle, SpringSource Scott Andrews, SpringSource Rossen ...
Contexts Mac版是Mac os平台上的一款非常方便便捷的Mac窗口管理工具,Contexts Mac版可以通过一次单击任何窗口切换:自动隐藏侧边栏显示您的Windows组组织。切换到窗口,单击其标题列表中。切换非常的方便简单不影响...
rxnetty-contexts-0.4.9.jar
In addition to this, Spring LDAP provides transaction support, a pooling library, an Object-Directory Mapping (ODM) framework, an LDIF parsing library with Spring Batch integration, exception ...
Generating an Application with AppWizard Understanding the Generated Code CDocument and CView CWinApp CWinThread Locating Threads CCmdTarget Commands for Classes About Message Maps How are ...
shape matching and object recongnition using shape contexts
3. New Features and Enhancements in Spring Framework 4.0 ............................................ 17 3.1. Improved Getting Started Experience .........................................................
The enthusiasm behind Node doesn't just reflect ... manageable code Use a complete application toolkit from start to finish, server to client Understand the power of JavaScript in a variety of contexts
Block Formatting Contexts Demo
Finally, you will implement various game elements into Unity, publish your own customer reward application, and get to know the best practices and approaches when designing gamified experiences. ...
DEVELOPING APPLICATIONS WITH VISUAL STUDIO.NET is an in-depth guide that takes Windows programming to the next level: creating .NET applications that leverage the prior knowledge and experience of C++...
这是shape contexts 的matlab程序,用于图像识别、检索等方面
The authors draw upon their rich and varied experience to offer improved methods for object development and numerous examples that tackle the complex problems faced by software engineers, including ...