import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//解决跨域问题
@SpringBootConfiguration
public class WebConfig implements WebMvcConfigurer{
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowCredentials(true)
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.maxAge(3600);
}
}
03-25
27万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-30
6万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-18
01-14
22万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-05
2410
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-17
5874
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-28
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交