一、后端添加注解@CrossOrigin并设置参数 allowCredentials = "true" , allowedHeaders = "*" 二、前端ajax设置参数xhrFields:{withCredentials:true}