获取本类service路径,然后字符串截取和拼接
String classpath= this.getClass().getResource("/").getPath();
String path = classpath.substring(0,classpath.length() - "WEB-INF/classes/".length());
System.out.println(path);
Path file=new File(path+"assets/img/code.png").toPath();