Skip to content

Commit

Permalink
Merge pull request #227 from elandau/nextgen
Browse files Browse the repository at this point in the history
Fix bug where wrong class loader is used during class path scanning
  • Loading branch information
elandau committed Jul 31, 2015
2 parents 76f0d95 + c60b3f5 commit 9708949
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -29,13 +29,14 @@ public ClassPathModuleListProvider(List<String> packages) {
public List<Module> get() {
List<Module> modules = new ArrayList<>();
ClassPath classpath;
ClassLoader loader = Thread.currentThread().getContextClassLoader();
for (String pkg : packages) {
try {
classpath = ClassPath.from(Thread.currentThread().getContextClassLoader());
classpath = ClassPath.from(loader);
for (ClassPath.ClassInfo classInfo : classpath.getTopLevelClassesRecursive(pkg)) {
try {
// Include Modules that have at least on Conditional
Class<?> cls = Class.forName(classInfo.getName(), false, ClassLoader.getSystemClassLoader());
Class<?> cls = Class.forName(classInfo.getName(), false, loader);
if (!cls.isInterface() && !Modifier.isAbstract( cls.getModifiers() ) && Module.class.isAssignableFrom(cls)) {
if (isAllowed((Class<? extends Module>) cls)) {
modules.add((Module) cls.newInstance());
Expand Down

0 comments on commit 9708949

Please sign in to comment.