Resource r = new ClassPathResource("log4j.properties");
File f = r.getFile().getParentFile().getParentFile()
.getParentFile();
String path = f.getAbsolutePath() + File.separator + "sitemap.xml";
用spring resource 接口获取 web应用的ROOT目录
最新推荐文章于 2024-07-28 23:56:48 发布
本文介绍了一种在Java中通过ClassPathResource获取特定配置文件路径的方法。主要关注如何从项目的资源目录中定位到log4j.properties文件,并进一步获取sitemap.xml文件的绝对路径。
5366

被折叠的 条评论
为什么被折叠?



