1、非spring项目和普通项目通用方法:
String path = Thread.currentThread().getContextClassLoader().getResource("cc/aa.txt").getPath();
2、spring项目可以用spirng自带的ResourceUtils
File file=ResourceUtils.getFile("classpath:note/aa.txt");
标签:aa,静态,spring,路径,idea,ResourceUtils,txt From: https://www.cnblogs.com/wenwenzuiniucha/p/17277824.html