首页>代码>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日
最近浏览更多
qinzhifang  LV1 3月15日
lxy135  LV1 2023年10月10日
dixiu000  LV4 2023年9月25日
卡布琪洛  LV4 2023年6月9日
szf123  LV12 2023年5月30日
陆程江  LV2 2023年5月28日
茫茫人海中的小牛  LV10 2023年4月23日
240598911  LV10 2023年4月16日
duwanfa  LV3 2023年4月15日
做你的景天  LV7 2023年4月12日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友