问题:
在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 {