第一种
ClassPathResource classPathResource = new ClassPathResource("static/index.html");
File file = classPathResource.getFile();
第二种
URL resource = this.getClass().getResource("/static/index.html");
File file = new File(resource.getFile());
第三种
URL resource = Thread.currentThread().getContextClassLoader().getResource("static/index.html");
File file = new File(resource.getFile());