@CrossOrigin(origins ="http://192.168.0.105:8080",maxAge = 3600) @RequestMapping( value = "/index",method = RequestMethod.GET) public String getSuccess(HttpServletResponse response){ return "-------------------tom-----------------------------"; }
此版本在 1.5版本是可以实现跨域的,
但是到2.0版本就不可以了,
要用下面的方法
@CrossOrigin(allowCredentials="true") @RequestMapping( value = "/index",method = RequestMethod.GET) public String getSuccess(HttpServletResponse response){ return "-------------------tom-----------------------------"; }
@CrossOrigin(allowCredentials="true")加参数就可以实现跨域,这浪费我好久。