zoukankan      html  css  js  c++  java
  • springboot后台跨域设置

    @Configuration
    public class CorsConfig {

    @Bean
    public FilterRegistrationBean getBean() {
    System.out.println("进入跨域设置");
    CorsConfiguration config = new CorsConfiguration();
    config.setAllowedHeaders(Arrays.asList("*"));
    config.setAllowedMethods(Arrays.asList("*"));
    config.setAllowedOrigins(Arrays.asList("*"));
    config.setExposedHeaders(Arrays.asList("token"));
    UrlBasedCorsConfigurationSource configurationSource = new UrlBasedCorsConfigurationSource();
    configurationSource.registerCorsConfiguration("/**", config);
    CorsFilter corsFilter = new CorsFilter(configurationSource);
    return new FilterRegistrationBean(corsFilter, new ServletRegistrationBean[0]);
    }
    }
  • 相关阅读:
    class线程信息
    Class 文件简介
    JVM对象及垃圾回收处理
    jvm体系结构
    查找

    二叉树
    队列


  • 原文地址:https://www.cnblogs.com/brxHqs/p/11529307.html
Copyright © 2011-2022 走看看