Java 类org.springframework.boot.loader.LaunchedURLClassLoader 实例源码

项目:springboot-analysis    文件:LaunchedURLClassLoaderTest.java   
@Test
    public void test() {
        try {
            JarFile.registerUrlProtocolHandler();
            LaunchedURLClassLoader classLoader = new LaunchedURLClassLoader(
                    new URL[] {
                            new URL("jar:file:/Users/fangjian/Develop/gitrepository/springboot-analysis/springboot-executable-jar/target/executable-jar-1.0-SNAPSHOT.jar!/lib/spring-boot-loader-1.3.5.RELEASE.jar!/")
                            , new URL("jar:file:/Users/fangjian/Develop/gitrepository/springboot-analysis/springboot-executable-jar/target/executable-jar-1.0-SNAPSHOT.jar!/lib/spring-boot-1.3.5.RELEASE.jar!/")
                    },
                    LaunchedURLClassLoaderTest.class.getClassLoader());

//            classLoader.loadClass("org.springframework.boot.loader.JarLauncher");
//            classLoader.loadClass("org.springframework.boot.SpringApplication");
            classLoader.loadClass("org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
项目:java-agent    文件:SpringBootRuleITest.java   
@Test
public void testFindOpenTracingAgentRules() throws Exception {
    File f = new File(System.getProperty("rules.path"));
    URL[] urls = new URL[1];
    urls[0] = f.toURI().toURL();

    try (LaunchedURLClassLoader loader = new LaunchedURLClassLoader(urls,
            ClassLoader.getSystemClassLoader())) {

        assertNotNull(loader.getResource("test.rule"));
    }
}
项目:spring-cloud-dashboard    文件:BootClassLoaderFactory.java   
@Override
protected ClassLoader createClassLoader(URL[] urls) throws Exception {
    return new LaunchedURLClassLoader(urls, parent);
}
项目:spring-cloud-dataflow    文件:BootClassLoaderFactory.java   
@Override
protected ClassLoader createClassLoader(URL[] urls) throws Exception {
    return new LaunchedURLClassLoader(urls, parent);
}