| | |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.ConcurrentMap; |
| | | |
| | | import javax.servlet.ServletContext; |
| | | |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.SysCompany; |
| | | import com.matrix.system.common.service.SysCompanyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.core.Ordered; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.context.ServletContextAware; |
| | | |
| | |
| | | * @author:姜友瑶 |
| | | * @date 2016年10月18日 |
| | | */ |
| | | @Controller |
| | | public class InitWebContainer implements ServletContextAware{ |
| | | @Component |
| | | @Order(Ordered.HIGHEST_PRECEDENCE) |
| | | public class InitWebContainer implements ApplicationRunner { |
| | | |
| | | |
| | | private static final String TRUE = "true"; |
| | | |
| | | private ServletContext servletContext; |
| | | |
| | | static private final String LANGUAGE_ZH = "zh"; |
| | | |
| | |
| | | * |
| | | * 容器启动后加载数据 |
| | | * @author:姜友瑶 |
| | | * @param sc |
| | | * @date 2016年10月18日 |
| | | */ |
| | | @Override |
| | | public void setServletContext(ServletContext sc) { |
| | | this.servletContext = sc; |
| | | public void run(ApplicationArguments args) { |
| | | |
| | | // 初始化调试模式 |
| | | initDebug(); |
| | |
| | | //初始化公司 |
| | | initParams(); |
| | | LogUtil.info("\r\n\r\n**********************************************\r\n" |
| | | + "* =========== Matrix启动成功 ===========\r\n" |
| | | + "* =========== 成功 ===========\r\n" |
| | | + "* DEBUG模式:" + debug+"*\r\n" |
| | | + "* 语言环境:" + Locale.getDefault().getLanguage()+"\r\n" |
| | | |
| | |
| | | for (SysCompany sysCompany : company) { |
| | | companyMap.put(sysCompany.getComWebUrl(), sysCompany); |
| | | } |
| | | servletContext.setAttribute("companyMap", companyMap); |
| | | LocalCache.save("companyMap", companyMap); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |