All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arextest.web.api.service.beans.GlobalCrossOriginConfiguration Maven / Gradle / Ivy

There is a newer version: 0.7.0.1
Show newest version
package com.arextest.web.api.service.beans;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

/**
 * @author jmo
 * @since 2022/1/31
 */
@SpringBootConfiguration
public class GlobalCrossOriginConfiguration {

  @Bean
  public CorsFilter corsFilter() {
    CorsConfiguration config = new CorsConfiguration();
    config.applyPermitDefaultValues();
    UrlBasedCorsConfigurationSource corsConfigurationSource = new UrlBasedCorsConfigurationSource();
    corsConfigurationSource.registerCorsConfiguration("/**", config);
    return new CorsFilter(corsConfigurationSource);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy