package ll.highway.util; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * @author zhangcunli * 解决跨域问题 */ @Configuration public class Cors extends WebMvcConfigurerAdapter { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOrigins("*") .allowedMethods("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH") .allowCredentials(true).maxAge(3600); } }
SpringBoot解决跨域访问的问题
猜你喜欢
转载自blog.csdn.net/qiunian144084/article/details/79297412
今日推荐
周排行