service中获取request、session、ServletContext

public String getLoginPersonDeptId() throws Exception {
		ServletRequestAttributes attribute = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
		return attribute.getRequest().getSession().getAttribute("#_branchId").toString();
	}


String dstPath =  ContextLoader.getCurrentWebApplicationContext().getServletContext().getRealPath("\\tmp");

 

 

你可能感兴趣的:(java)