Access to XMLHttpRequest at 'http://localhost:8088/upload' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
前端访问后端链接这个错误,一般是跨域问题所导致的,在后端的接口上加入@CrossOrigin注解即可
@RestController
@CrossOrigin可以加在类上,也可以加到方法上
public class StudentController {
@Autowired
private StudentService studentService;
@RequestMapping("/upload")
public String uploadStudent(){
return "ok";
}
}