加上@CrossOrigin注解,例:
@CrossOrigin
@RequestMapping("/test")
public ResponseMessage test(){
return ResultUtil.error(ResultEnum.EMPTY_PASSWORD);
}
补充:
@CrossOrigin(origins="http://www.a.com:8888",allowCredentials = "true")
origins设置允许跨域请求的域
allowCredentials允许设置Cookie