zoukankan      html  css  js  c++  java
  • Spring Boot全局支持CORS(跨源请求)

     1 import org.springframework.context.annotation.Configuration;
     2 import org.springframework.web.servlet.config.annotation.CorsRegistry;
     3 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
     4 
     5 /**
     6  * @Author:CoderZZ
     7  * @Description:Spring Boot全局支持CORS(跨源请求)
     8  * @Date:Created in 10:57 2018/2/8.
     9  */
    10 @Configuration
    11 public class WebCorsConfigurerAdapter extends WebMvcConfigurerAdapter
    12 {
    13 
    14     @Override
    15     public void addCorsMappings(CorsRegistry registry) {
    16         registry.addMapping("/**").
    17                 allowedOrigins("*").
    18                 allowedMethods("GET", "HEAD", "POST","PUT", "DELETE", "OPTIONS").
    19                 allowedHeaders("Content-Type","Access-Control-Allow-Headers","Authorization","X-Requested-With").
    20                 allowCredentials(true);
    21     }
    22 }
  • 相关阅读:
    Postman post csrf_token
    CBV
    nginx+uWSGI+django部署web服务器
    JS绘图
    get_字段_display()
    limit_choices_to
    window.onload=function(){};
    模拟百度搜索项目
    事件冒泡
    解绑事件
  • 原文地址:https://www.cnblogs.com/Java-Script/p/11089859.html
Copyright © 2011-2022 走看看