首页>代码>springboot+vue+axios全栈项目开发中的跨域解决方案>/spring-boot-cross-domain-demo/src/main/java/com/cxs/config/MyMvcConfig.java
package com.cxs.config; /** * @Project: spring-boot-cross-domain-demo * @Author: cxs2014501@163.com * @Create: 2023/2/9 15:11 * @Description: **/ // @Configuration //public class MyMvcConfig implements WebMvcConfigurer { // // 解决同源策略引起的跨域 // @Override // public void addCorsMappings(CorsRegistry registry) { // registry.addMapping("/**") //1.代表当前的哪些方法添加请求头 // .allowedMethods("*") //2.设置允许的方法 // .allowedHeaders("*") //3.设置请求头 // .allowedOriginPatterns("*") //4.设置是否跨域 // .allowCredentials(true); //5.设置是否允许携带cookie // } //}

zengxq056 LV2
2023年3月18日
微信网友_6368711690080256 LV3
2023年2月28日
hbsoft2008 LV16
2023年2月22日
最代码官方 LV168
2023年2月12日