解决跨域问题
程序员文章站
2024-02-01 21:12:34
...
配置类实现WebMvcConfigurer接口
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOrigins("*")
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
.allowCredentials(true).maxAge(3600);
}