解决请求跨域

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);
    }
}

 

posted @ 2019-08-02 16:21  爱吃香蕉和菠萝  阅读(244)  评论(0编辑  收藏  举报