CORS
这里起了两个服务,一个端口是8080,一个是8089.算是不同源
后台配置---8089
@CrossOrigin(origins = "http://localhost:8080")
@RequestMapping(value = "/get", method = RequestMethod.POST)
public HashMap<String, Object> get(@RequestParam String name) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("title", "hello world");
map.put("name", name);
return map;
}
如果浏览器不支持cors,可以使用
@RequestMapping(value = "/find/users", method = RequestMethod.GET)
这里起了两个服务,一个端口是8080,一个是8089.算是不同源
后台配置---8089
@CrossOrigin(origins = "http://localhost:8080")
@RequestMapping(value = "/get", method = RequestMethod.POST)
public HashMap<String, Object> get(@RequestParam String name) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("title", "hello world");
map.put("name", name);
return map;
}
如果浏览器不支持cors,可以使用
@RequestMapping(value = "/find/users", method = RequestMethod.GET)