Search in sources :

Example 1 with Blade.$

use of com.blade.Blade.$ in project blade by biezhi.

the class BladeInitListener method contextInitialized.

@Override
public void contextInitialized(ServletContextEvent sce) {
    Blade blade = Blade.$();
    if (!blade.isInit()) {
        LOGGER.info("jdk.version\t=> {}", SystemKit.getJavaInfo().getVersion());
        LOGGER.info("user.dir\t\t=> {}", System.getProperty("user.dir"));
        LOGGER.info("java.io.tmpdir\t=> {}", System.getProperty("java.io.tmpdir"));
        LOGGER.info("user.timezone\t=> {}", System.getProperty("user.timezone"));
        LOGGER.info("file.encoding\t=> {}", System.getProperty("file.encoding"));
        long initStart = System.currentTimeMillis();
        ServletContext servletContext = sce.getServletContext();
        String webRoot = DispatchKit.getWebRoot(servletContext);
        blade.webRoot(webRoot);
        EmbedServer embedServer = blade.embedServer();
        if (null != embedServer) {
            embedServer.setWebRoot(webRoot);
        }
        LOGGER.info("blade.webroot\t=> {}", webRoot);
        try {
            // initialization ioc
            IocApplication iocApplication = new IocApplication();
            iocApplication.initBeans();
            LOGGER.info("blade.isDev\t=> {}", blade.isDev());
            BannerStarter.printStart();
            String appName = blade.config().get("app.name", "Blade");
            appName = new String(appName.getBytes("iso8859-1"), "utf-8");
            LOGGER.info("{} initialize successfully, Time elapsed: {} ms.", appName, System.currentTimeMillis() - initStart);
            iocApplication.initCtx(servletContext);
            blade.init();
        } catch (Exception e) {
            LOGGER.error("ApplicationContext init error", e);
        }
    }
}
Also used : EmbedServer(com.blade.embedd.EmbedServer) ServletContext(javax.servlet.ServletContext) Blade(com.blade.Blade) IocApplication(com.blade.ioc.IocApplication)

Aggregations

Blade (com.blade.Blade)1 EmbedServer (com.blade.embedd.EmbedServer)1 IocApplication (com.blade.ioc.IocApplication)1 ServletContext (javax.servlet.ServletContext)1