All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.jiangzeyin.system.init.SystemInitControl Maven / Gradle / Ivy

package cn.jiangzeyin.system.init;

import cn.jiangzeyin.system.SystemBean;
import cn.jiangzeyin.system.log.SystemLog;
import cn.jiangzeyin.util.util.PackageUtil;

import java.io.IOException;
import java.lang.reflect.Method;
import java.util.List;

/**
 * @author jiangzeyin
 * Created by jiangzeyin on 2017/2/7.
 */
public class SystemInitControl {

    public static void init() {
        try {
            List list = PackageUtil.getClassName(SystemBean.getInstance().initPackageName);
            if (list == null)
                return;
            for (String name : list) {
                try {
                    if (name.contains("$"))
                        continue;
                    Class cls = Class.forName(name);
                    if (cls == SystemInitControl.class)
                        continue;
                    Method method = cls.getMethod("init");
                    method.invoke(null);
                } catch (ClassNotFoundException e) {
                    SystemLog.ERROR().error("预加载包错误:" + name, e);
                } catch (Exception e) {
                    SystemLog.ERROR().error("预加载包错误:" + name + "  执行错误", e);
                }
            }
        } catch (IOException e) {
            SystemLog.ERROR().error("预加载包错误", e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy