springboot项目中classpath指向了哪里,以及如何获取springboot项目默认的的classpath

一、classpath指向了那里

1、用maven构建(build)项目时,默认的classpath指向target/classes/

2、用maven打包(package)项目时,默认的classpath指向war内部的WEB-INF/classes/

二、如果获取springboot项目默认的classpath

// 获取classpath
String classpath = ResourceUtils.getURL("classpath:").getPath();

 

posted @ 2020-10-21 11:48  anderson_1996  阅读(4405)  评论(0编辑  收藏  举报