【发布时间】:2013-07-09 09:53:41
【问题描述】:
是否有配置反射库的解决方案,以便它也扫描在运行时使用 URLClassLoader 添加的 JAR?
目前,反射只是扫描 ClassLoader 中的 URL。这是我现在使用的配置:
Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader()));
我在反射库的文档中找不到任何提示。
编辑: 这就是我加载 jar 文件的方式:
File f = new File("C:/Users/mkorsch/Desktop/test-reflections.jar");
URLClassLoader urlCl = new URLClassLoader(new URL[] {f.toURI().toURL()},System.class.getClassLoader());
【问题讨论】:
-
这些罐子是如何添加的?您是否使用现有机制?
-
对我的问题添加了编辑...
标签: java runtime classloader reflections