1.进行ajax请求时加入
2.过滤器中设置请求头
//跨域配置
response1.setHeader("Access-Control-Allow-Credentials","true");
response1.setHeader("Access-Control-Allow-Origin","http://192.168.1.114:8021");(注意:这里写前端服务器地址,如果不是这个服务器的请求,则会被过滤)
response1.setHeader("Access-Control-Allow-Headers","Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");