前后台对接springboot跨域支持

xiaoxiao2021-03-01  6

@Component public class CorsFilter { /** * 跨域支持 */ @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**").allowedMethods("*"); } }; } }

html前台加入

最上面加入 <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> 最下面加入 <!--[if lte IE 9]> <script src="//cdn.bootcss.com/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js" type="text/javascript" charset="utf-8"></script> <![endif]-->

 

转载请注明原文地址: https://www.6miu.com/read-4150275.html

最新回复(0)