跨域配置如下:
@Configuration
public class CorsConfig implements WebMvcConfigurer {
/**
* 跨域配置
* - Access-Control-Allow-Origin的介绍:
* - https://blog.csdn.net/MicroAnswer/article/details/102913571
* - SpringMVC路径匹配规则:
* - 1、https://wenku.baidu.com/view/508c0286b3717fd5360cba1aa8114431b90d8ec8.html
* - 2、https://www.cnblogs.com/selfchange/p/spring.html
*
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") // 允许跨域访问的路径
.allowedOrigins("http://localhost:8083") // 允许跨域访问的源