Пример #1
0
 static {
   appid = ConfigUtil.getConfigParam("WX.APPID");
   mch_id = ConfigUtil.getConfigParam("WX.MCH_ID");
   key = ConfigUtil.getConfigParam("WX.KEY");
   unifiedorder = ConfigUtil.getConfigParam("WX.UNIFIEDORDER");
   orderquery = ConfigUtil.getConfigParam("WX.ORDERQUERY");
 }
Пример #2
0
 @Override
 public void contextInitialized(ServletContextEvent event) {
   try {
     // 初始化配置
     ConfigUtil.configure(
         event.getServletContext().getRealPath("/"),
         event.getServletContext().getRealPath("/WEB-INF/config/web-config.txt"));
     // 初始化日志
     PropertyConfigurator.configure(
         event.getServletContext().getRealPath("/WEB-INF/config/log4j.properties"));
     // 初始化Application
     Application.configure(event.getServletContext());
     // 初始化数据库
     HibernateSessionFactory.configure(
         event.getServletContext().getRealPath("/WEB-INF/config/hibernate.cfg.xml"));
     // 初始化业务线程池
     HttpServletThreadPoolExcutorContainer.configure(
         event.getServletContext(),
         "com.flower",
         new ThreadPoolConfig(
             ThreadPoolType.TIMER_THREADPOOL.name(),
             ThreadPoolKindEnum.SCHEDULE,
             1,
             0,
             new MyThreadFactory(ThreadPoolType.TIMER_THREADPOOL.name(), "时间线程", 1)),
         new ThreadPoolConfig(
             ThreadPoolType.LOGIC_THREADPOOL.name(),
             ThreadPoolKindEnum.FAIR,
             5,
             5,
             new MyThreadFactory(ThreadPoolType.LOGIC_THREADPOOL.name(), "逻辑线程", 5)));
   } catch (Exception e) {
     log.error("初始化Servlet容器异常", e);
   }
 }