其他分享
首页 > 其他分享> > springboot解决跨域访问

springboot解决跨域访问

作者:互联网

/**
 * 跨域设置
 * @Version 1.0.0
 * @Description
 */
@Configuration
public class CorsConfig extends WebMvcConfigurationSupport {

    @Override
    protected void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowCredentials(true)
                .allowedMethods("GET","POST","DELETE","PUT")
                .maxAge(3600);
    }
}

标签:1.0,springboot,maxAge,访问,Version,registry,跨域
来源: https://www.cnblogs.com/lazyli/p/12228931.html