use of org.glassfish.jersey.examples.reload.compiler.AppClassLoader in project jersey by jersey.
the class App method createResourceConfig.
private static ResourceConfig createResourceConfig(File configFile) {
final ResourceConfig rc = new ResourceConfig();
try {
final AppClassLoader appClassLoader = new AppClassLoader(Thread.currentThread().getContextClassLoader());
final List<JavaFile> javaFiles = getJavaFiles(configFile);
Compiler.compile(appClassLoader, javaFiles);
for (JavaFile javaFile : javaFiles) {
try {
rc.registerClasses(appClassLoader.loadClass(javaFile.getClassName()));
} catch (final ClassNotFoundException ex) {
LOGGER.info(String.format(" ! class %s not found.\n", javaFile.getClassName()));
}
}
} catch (final Exception ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
return rc;
}
Aggregations