
如图:
1.在config配置包中创建一个CorsConfig配置类
2.将下面代码复制到这个类中即可
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@Configuration
public class CorsConfig {
@Bean
public CorsFilter corsFilter(){
CorsConfiguration corsConfiguration=new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*");
corsConfiguration.addAllowedHeader("*");
corsConfiguration.addAllowedMethod("*");
UrlBasedCorsConfigurationSource source=new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**",corsConfiguration);
return new CorsFilter(source);
}
}
![[字符串和内存函数]strcmp和strncmp以及memcmp的区别](https://img-blog.csdnimg.cn/a8ff6dd1b49a45139ececbf8a9e3a1a3.png)

![[maven] 创建 spring boot 项目及使用 Jenkins 运行 maven](https://img-blog.csdnimg.cn/cce1055f31c0456b8f337939a7c98eb7.png)











![[ESP32 IDF+Vscode]蓝牙配网后采用上传温湿度数据至阿里云(MQTT协议)](https://img-blog.csdnimg.cn/2ae7c9b958d540068bfd3f74289b988a.png)


