spring boot Cors 跨域
在访问web工程的时候,经常会报一些跨域的错误:CORS header ‘Access-Control-Allow-Origin’ missing
spring boot中的cors设定方式
@ConfigurationpublicclassWebConfigextendsWebMvcConfigurerAdapter{@OverridepublicvoidaddCorsMappings(CorsRegistryregistry){registry.addMapping("/**").allowedOrigins("*").allowCredentials(true).allowedMethods("GET","POST","DELETE","PUT").maxAge(3600);}}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。