import org.springframework.web.servlet.support.RequestContext;
//获取项目的classes目录,例如:D:/songjinzhou/software/apache-tomcat-7.0.52/webapps/项目名/WEB-INF/classes/
String root = RequestContext.class.getResource("/").getFile();
//获取项目根目录,例如:D:\songjinzhou\software\apache-tomcat-7.0.52\webapps\项目名
String templateFilePath = new File(root).getParentFile().getParentFile().getCanonicalPath()+"/excel_template/abc.xls"
以下是我精心整理的文章:
- Java 基础面试题,助你轻松搞定面试官,请点击这里进入
- Java 集合底层原理剖析(List、Set、Map、Queue),请点击这里进入
- 服务注册与发现原理剖析(Eureka、Zookeeper、Nacos),请点击这里进入
- 分布式配置管理的原理剖析(Spring Cloud Config、Apollo、Nacos),请点击这里进入