简单方法: 1.创建项目,添加web依赖 2.添加控制器 3.添加@CrossOrigin注解 value指的是允许的origin maxage限制时间无需探查 allowheaders允许的请求头 WebMVCConfigurer全局配置 重写addcrosMappings方法 相关文章: