spring boot将登录验证码放在项目目录下

String path = code.getClass().getClassLoader().getResource("").getPath();//获取静态资源路径
System.out.println(path);//这里获取的path还要加个static。和传统项目有点不同。
ImageIO.write(image,"jpg",new File(path+"static/images/image.jpg"));

 

猜你喜欢

转载自blog.csdn.net/Lei_Da_Gou/article/details/83015426
今日推荐