@Override
public void load(Settings settings) throws Exception {
ServiceFramwork.injector = Guice.createInjector(Stage.PRODUCTION, ServiceFramwork.AllModules);
final List<Module> moduleList = new ArrayList<Module>();
final List<CtClass> controllers = list();
final ControllerEnhancer enhancer = new FilterEnhancer(settings);
for (String item : WowCollections.split2(settings.get("application.controller"), ",")) {
//自动加载所有Action类
ServiceFramwork.scanService.scanArchives(item, new ScanService.LoadClassEnhanceCallBack() {
@Override
public Class loaded(DataInputStream classFile) {
try {
CtClass ctClass = enhancer.enhanceThisClass(classFile);
logger.info("controller load : " + ctClass.getName());
controllers.add(ctClass);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
});
}
enhancer.enhanceThisClass2(controllers);
for (String item : WowCollections.split2(settings.get("application.controller.default","net.csdn.api.controller.SystemInfoController"), ",")) {
try {
moduleList.add(bindAction(Class.forName(item)));
} catch (Exception e) {
logger.error("load default controller error:" + e);