whycxzp
2021-12-29 f2634f1df96eaa46d76f23b5bbeda579de468e14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.whyc.util;
 
import com.whyc.pojo.UserInf;
import org.springframework.boot.system.ApplicationHome;
 
import javax.servlet.http.HttpServletRequest;
import java.io.File;
 
/**
 * 通用工具列
 */
public class CommonUtil {
 
    /**获取当前Session中的属性user*/
    public static UserInf getUser(HttpServletRequest request) {
        return (UserInf) request.getSession().getAttribute("user");
    }
 
    public static String classesPath(){
        ApplicationHome applicationHome = new ApplicationHome(CommonUtil.class);
        File jarFile = applicationHome.getDir();
        return jarFile.toString();
    }
}