移到zheng-common

This commit is contained in:
shuzheng 2017-01-19 22:07:59 +08:00
parent 07394236e9
commit ca58bd96e1
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
package com.zheng.common.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.context.ServletContextAware;
import javax.servlet.ServletContext;
/**
* 启动解压zhengAdmin-x.x.x.jar到resources目录
* Created by shuzheng on 2016/12/18.
*/
public class ZhengAdminUtil implements InitializingBean, ServletContextAware {
private static Logger _log = LoggerFactory.getLogger(ZhengAdminUtil.class);
@Override
public void afterPropertiesSet() throws Exception {
}
@Override
public void setServletContext(ServletContext servletContext) {
_log.info("===== 开始解压zheng-admin =====");
String version = PropertiesFileUtil.getInstance().get("zheng-admin.version");
_log.info("zheng-admin.jar 版本: {}", version);
String jarPath = servletContext.getRealPath("/WEB-INF/lib/zheng-admin-" + version + ".jar");
_log.info("zheng-admin.jar 包路径: {}", jarPath);
String resources = servletContext.getRealPath("/resources") + "/zheng-admin";
_log.info("zheng-admin.jar 解压到: {}", resources);
JarUtil.decompress(jarPath, resources);
_log.info("===== 解压zheng-admin完成 =====");
}
}