zoukankan      html  css  js  c++  java
  • Jeecg 容器初始化监听器

    文件位置:

    F:jeecg-bpm-3.8jeecg-bpm-3.8-masterjeecg-bpm-3.8srcmainjavaorgjeecgframeworkwebsystemlistenerInitListener.java

     1 package org.jeecgframework.web.system.listener;
     2 
     3 import javax.servlet.ServletContextEvent;
     4 
     5 import org.apache.commons.lang.CommonRandomUtil;
     6 import org.apache.commons.lang.StringUtil;
     7 import org.jeecgframework.web.system.service.DynamicDataSourceServiceI;
     8 import org.jeecgframework.web.system.service.MutiLangServiceI;
     9 import org.jeecgframework.web.system.service.SystemService;
    10 import org.springframework.web.context.WebApplicationContext;
    11 import org.springframework.web.context.support.WebApplicationContextUtils;
    12 
    13 
    14 /**
    15  * 系统初始化监听器,在系统启动时运行,进行一些初始化工作
    16  * @author laien
    17  *
    18  */
    19 public class InitListener  implements javax.servlet.ServletContextListener {
    20     
    21     public void contextDestroyed(ServletContextEvent arg0) {
    22         
    23     }
    24 
    25     public void contextInitialized(ServletContextEvent event) {
    26         WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
    27         SystemService systemService = (SystemService) webApplicationContext.getBean("systemService");
    28 //        MenuInitService menuInitService = (MenuInitService) webApplicationContext.getBean("menuInitService");
    29         MutiLangServiceI mutiLangService = (MutiLangServiceI) webApplicationContext.getBean("mutiLangService");
    30         DynamicDataSourceServiceI dynamicDataSourceService = (DynamicDataSourceServiceI) webApplicationContext.getBean("dynamicDataSourceService");
    31         
    32         /**
    33          * 第一部分:对数据字典进行缓存
    34          */
    35         if(StringUtil.isNotEmpty(systemService)){
    36             systemService.initAllTypeGroups();
    37             systemService.initAllTSIcons();
    38         }
    39         
    40         
    41 //        /**
    42 //         * 第二部分:自动加载新增菜单和菜单操作权限
    43 //         * 说明:只会添加,不会删除(添加在代码层配置,但是在数据库层未配置的)
    44 //         */
    45 //        if("true".equals(ResourceUtil.getConfigByName("auto.scan.menu.flag").toLowerCase())){
    46 //            menuInitService.initMenu();
    47 //        }
    48         
    49         /**
    50          * 第三部分:加载多语言内容
    51          */
    52         if(StringUtil.isNotEmpty(systemService)){
    53             mutiLangService.initAllMutiLang();
    54         }
    55         
    56         /**
    57          * 第四部分:加载配置的数据源信息
    58          */
    59         if(StringUtil.isNotEmpty(systemService)){
    60             dynamicDataSourceService.initDynamicDataSource();
    61         }
    62     }
    63     
    64     /**
    65      * 自动加载新增菜单和菜单操作权限
    66      * 说明:只会添加,不会删除(添加在代码层配置,但是在数据库层未配置的)
    67      */
    68     private static boolean initMenuFlag = CommonRandomUtil.TRUE;    
    69 }
  • 相关阅读:
    EF 简单的 CRUD、分页 代码笔记
    C#中的正则 Regex类
    动态字符串 Stringbuilder类
    C# 字符串操作
    集合简单总结 ArrayList、List、Hashtable、Dictionary
    C#面向对象2 静态类、静态成员的理解
    C#面向对象1 类 以及 类的继承(new、ovverride)
    无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它
    WebClient上传音频文件
    发布网站详细步骤(.Net)
  • 原文地址:https://www.cnblogs.com/Jeely/p/10985349.html
Copyright © 2011-2022 走看看