解决前端“CORS 头缺少 ‘Access-Control-Allow-Origin‘“问题

问题:
在HbuilderX中使用mui.ajax()函数访问后台数据时,发现出现:

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

解决:
在后台Controller类上加入:

@CrossOrigin(origins = "*", maxAge = 3600)

如:

@CrossOrigin(origins = "*", maxAge = 3600)
public class UserController {
上一篇:Oracle 性能调优


下一篇:MySQL底层实现机制