springboot 跨域 ajax返回值跨域

    @RequestMapping(value ="/websitePositionList", method = RequestMethod.POST)*****重要
    public Map<String,Object> check2(PositionInfo positionInfo,HttpServletResponse response)throws UnsupportedEncodingException{
        response.addHeader("Access-Control-Allow-Origin", "*");***
        response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");**
        response.setHeader("Access-Control-Allow-Headers", "x-requested-with");***
        response.addHeader("Access-Control-Max-Age", "1800");//30 min***
        return map;//返回到页面  map里面定义的XXX  到页面上直接data.XX
    }
***代表重点 直接复制就可以
上一篇:使用Tlog完成日志链路追踪、收集、持久化


下一篇:表达式语言整理(不断更新)