Java拦截跨域请求处理

@Configuration

open classCorsConfig {

private funbuildConfig(): CorsConfiguration {

valconfig = CorsConfiguration()

config.allowedOrigins=listOf("*")

config.allowedHeaders=listOf("*")

config.allowedMethods=listOf("*")

returnconfig

}

@Bean

open funcorsFilter(): CorsFilter {

valsource = UrlBasedCorsConfigurationSource()

source.registerCorsConfiguration("/**", buildConfig())

returnCorsFilter(source)

}

}

你可能感兴趣的:(Java拦截跨域请求处理)