获取webapp下面的resources文件
String cssFilePath = request.getServletContext().getRealPath("/") + File.separator+"resources/lib/bootstrap-3.3.7/css/bootstrap.min.css"; File cssFile = new File(cssFilePath);
获取resources下面的文件
File test = ResourceUtils.getFile("classpath:ehcache.xml");
或者
File path = new File(ResourceUtils.getURL("classpath:ehcache.xml").getPath());