public class CorsConfiguration {

/**
* Wildcard representing <em>all</em> origins, methods, or headers.
*/
public static final String ALL = "*";

private static final List<HttpMethod> DEFAULT_METHODS;

static {
List<HttpMethod> rawMethods = new ArrayList<HttpMethod>(2);
rawMethods.add(HttpMethod.GET);
rawMethods.add(HttpMethod.HEAD);
DEFAULT_METHODS = Collections.unmodifiableList(rawMethods);
}

private List<String> allowedOrigins;

private List<String> allowedMethods;

private List<HttpMethod> resolvedMethods = DEFAULT_METHODS;

private List<String> allowedHeaders;

private List<String> exposedHeaders;

private Boolean allowCredentials;

private Long maxAge;

/**
* Construct a new {@code CorsConfiguration} instance with no cross-origin
* requests allowed for any origin by default.
* @see #applyPermitDefaultValues()
*/
public CorsConfiguration() {
}

/**
* Construct a new {@code CorsConfiguration} instance by copying all
* values from the supplied {@code CorsConfiguration}.
*/
public CorsConfiguration(CorsConfiguration other) {
this.allowedOrigins = other.allowedOrigins;
this.allowedMethods = other.allowedMethods;
this.resolvedMethods = other.resolvedMethods;
this.allowedHeaders = other.allowedHeaders;
this.exposedHeaders = other.exposedHeaders;
this.allowCredentials = other.allowCredentials;
this.maxAge = other.maxAge;
}

/**
Set<String> combined = new LinkedHashSet<String>(source);
return new ArrayList<String>(combined);
* Set the origins to allow, e.g. {@code "http://domain1.com"}.
* <p>The special value {@code "*"} allows all domains.
* <p>By default this is not set.
*/
public void setAllowedOrigins(List<String> allowedOrigins) {
this.allowedOrigins = (allowedOrigins != null ? new ArrayList<String>(allowedOrigins) : null);
}

配置类Configuration怎样使用的更多相关文章

  1. SpringBoot java配置类@Configuration 的两种写法

    首先在Springboot项目中,件一个java类,使用注解@Configuration  ,则这个类是SpringBoot bean的创建的配置文件类,,这种配置文件类有两种写法 1.使用包扫描 , ...

  2. Spring boot添加配置类@Configuration并初始化@Bean,@Resource和@Autowired都为null

    大写加黑,找了好久@Resource和@Autowired都依赖不到创建的bean的原因:@Bean的方法名即是创建的Bean名称 import org.activiti.engine.Process ...

  3. spring5 源码深度解析----- 被面试官给虐懵了,竟然是因为我不懂@Configuration配置类及@Bean的原理

    @Configuration注解提供了全新的bean创建方式.最初spring通过xml配置文件初始化bean并完成依赖注入工作.从spring3.0开始,在spring framework模块中提供 ...

  4. hibernate中3个重要的类 Configuration SessionFactory Session

    配置类Configuration 主要负责管理hibernate的配置信息以及启动hibernate,在hibernate运行时,配置文件取读底层的配置信息,基本包括数据库驱动,url.usernam ...

  5. Spring Boot中只能有一个WebMvcConfigurationSupport配置类

    首先将结论写文章的最前面,一个项目中只能有一个继承WebMvcConfigurationSupport的@Configuration类(使用@EnableMvc效果相同),如果存在多个这样的类,只有一 ...

  6. Springboot 配置类( @Configuration) 不能使用@Value注解从application.propertyes中加载值以及Environment为null解决方案

    最近遇到个场景,需要在使用@Bean注解定义bean的时候为对象设置一些属性,比如扫描路径,因为路径经常发布新特性的时候需要修改,所以就计划着放在配置文件中,然后通过@ConfigurationPro ...

  7. Spring源码解析 – @Configuration配置类及注解Bean的解析

    在分析Spring 容器创建过程时,我们知道容器默认会加载一些后置处理器PostPRocessor,以AnnotationConfigApplicationContext为例,在构造函数中初始化rea ...

  8. 【Spring】简述@Configuration配置类注册BeanDefinition到Spring容器的过程

    概述 本文以SpringBoot应用为基础,尝试分析基于注解@Configuration的配置类是如何向Spring容器注册BeanDefinition的过程 其中主要分析了 Configuratio ...

  9. @Component和@Configuration作为配置类的差别

    https://blog.csdn.net/long476964/article/details/80626930 虽然Component注解也会当做配置类,但是并不会为其生成CGLIB代理Class ...

随机推荐

  1. 转 awr自动收集脚本

    1. remote get awr report #!/usr/bin/ksh ####sample: sh awr.sh 20170515 20170516 AWR ### default it w ...

  2. jQuery学习笔记(1)-初探

    一.jQuery是什么 1.jQuery是一套JavaScript脚本库,而不是框架:就好比"System是程序集"是类库,而"ASP.NET MVC"是框架: ...

  3. LN : leetcode 238 Product of Array Except Self

    lc 238 Product of Array Except Self 238 Product of Array Except Self Given an array of n integers wh ...

  4. LN : leetcode 3 Longest Substring Without Repeating Characters

    lc 3 Longest Substring Without Repeating Characters 3 Longest Substring Without Repeating Characters ...

  5. CF817B Makes And The Product

    思路: 模拟,数学. 实现: #include <iostream> #include <cstdio> #include <algorithm> using na ...

  6. WordPress强制跳转https教程

    在互联网火热的今天,安全问题显得越来越重要,为了用户信息安全,很多热门网站都启用了https 有小伙伴就问:我启用了https,为什么访问的时候显示的还是http呢? 其实,有时候并不是因为我们ssl ...

  7. 网络编程基础_4.1TCP_服务端

    TCP_服务端 #include <stdio.h> // 1. 包含必要的头文件和库, 必须位于 windows之前 #include <WinSock2.h> #pragm ...

  8. day14-二分法、匿名函数、内置函数以及面向过程编程

    目录 二分法 匿名函数 内置函数 面向过程编程 二分法 二分法查找适用于数据量较大时,但是数据需要先排好顺序.主要思想是:(设查找的数组区间为array[low, high]) (1)确定该区间的中间 ...

  9. Python isdigit() 方法检测字符串是否只由数字组成

    Python isdigit() 方法检测字符串是否只由数字组成

  10. 22万个木箱!TWaver 3D极限压榨

    打开个门户网站都千呼万唤,我们还能期待网页上的3D技术会有“酣畅淋漓”.“一气呵成”的感受吗?也许现在还差点火候.但是HTML5.WebGL等技术一直在飞速的发展,可能很快你就会惊讶它的能力.现在,我 ...