随手记录前后端分离项目跨域问题解决
springboot 2:
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
/**跨域*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST");
}
}