如果在SPRINGBOOT中写的一个RestController的JSON返回对象希望跨域被调用,最简单的办法是在原有的RequestMapping的注解上再增加一个@CrossOrigin注解。
@CrossOrigin @RequestMapping(value = "/test", method = RequestMethod.GET) private List<Map<String,String>> zero_link() throws Exception {
参考
https://spring.io/blog/2015/06/08/cors-support-in-spring-framework
https://blog.youkuaiyun.com/yue29026/article/details/70860719