美文网首页
vue跨域处理

vue跨域处理

作者: Felix_Fang | 来源:发表于2019-05-22 10:34 被阅读0次
    package ;
    
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.web.cors.CorsConfiguration;
    import org.springframework.web.servlet.config.annotation.CorsRegistry;
    import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
    
    
    /**
     * @author felixfang
     * @date 2019/5/8 10:04
     * @description //TODO 跨域问题
     */
    @Configuration
    public class CORSConf {
    
        @Bean
        public WebMvcConfigurer corsConfigurer() {
            return new WebMvcConfigurer() {
                @Override
                public void addCorsMappings(CorsRegistry registry) {
                    registry.addMapping("/**")
                            .allowedHeaders("*")
                            .allowedMethods("*")
                            .allowedOrigins("*")
                            .allowCredentials(true);
                }
            };
        }
    }
    
    

    相关文章

      网友评论

          本文标题:vue跨域处理

          本文链接:https://www.haomeiwen.com/subject/relyzqtx.html