20211229
SpringBoot向前端返回图片数据流
核心代码:
/**
* 与前端进行图片交互的Controller
*/
@RestController
@RequestMapping("/img")
public class PictureController {
@GetMapping(value = "/getImage", produces = MediaType.IMAGE_JPEG_VALUE)
@ResponseBody
public byte[] getPicture(@RequestParam("fileName") String fileName) throws Exception {
System.out.println("前端请求的图片名称:");
System.out.println(fileName)