import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@Configuration
public class GlobalCorsConfig extends WebMvcConfigurationSupport {
/**
* Cors跨域问题
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowCredentials(true)
.allowedMethods("GET", "POST", "DELETE", "PUT")
.maxAge(3600);
}
}
springboot 2.0.0 配置支持跨域
猜你喜欢
转载自blog.csdn.net/sxg0205/article/details/107404141
今日推荐
周排行