解决请求跨域

package com.jeesite.modules;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @ClassName CORSConfiguration
 * @Description
 * @Author: dsh
 * @Date: 2019/6/3 10:41
 * @Version V1.0
 **/
@Configuration
public class CORSConfiguration extends WebMvcConfigurerAdapter {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedMethods("*")
                .allowedOrigins("*")
                .allowedHeaders("*");
        super.addCorsMappings(registry);
    }
}
原文地址:https://www.cnblogs.com/dsh2018/p/11289291.html