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-ui =====");
        String version = PropertiesFileUtil.getInstance().get("zheng-ui.version");
        _log.info("zheng-ui.jar 版本: {}", version);
        String jarPath = servletContext.getRealPath("/WEB-INF/lib/zheng-ui-" + version + ".jar");
        _log.info("zheng-ui.jar 包路径: {}", jarPath);
        String resources = servletContext.getRealPath("/resources") + "/zheng-ui";
        _log.info("zheng-ui.jar 解压到: {}", resources);
        JarUtil.decompress(jarPath, resources);
        _log.info("===== 解压zheng-ui完成 =====");
    }

}

@@ -1031,16 +1031,23 @@
 ealPath(
+%22/%22) + 
 %22/resour
@@ -1049,22 +1049,16 @@
 esources
-%22) + %22
 /zheng-u

修复部分打包方式导致zheng-ui解压目标目录不对的问题