response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "no-cache");
response.setContentType(MediaType.IMAGE_JPEG_VALUE);
开发设置中禁用缓存的参考博客:
转载自CSDN:https://blog.csdn.net/u014482758/article/details/43486081/
/**
* 将图片二维码base64编码
*
* @param os 输出流
* @return base64字符串
* @throws IOException
*/
public static String encodeBase64ImgCode(ByteArrayOutputStream os)
throws IOException {
Objects.requireNonNull(os);
byte[] b = os.toByteArray();
String imgString = Base64.getEncoder().encodeToString(b);
return BASE64_IMAGE_PREFIX + imgString;
}
图片base64编码的好处:(可阅读下面不错的一个博文)
转载自博客园:https://www.cnblogs.com/coco1s/p/4375774.html
原文:https://www.cnblogs.com/erlangha/p/14462492.html