Merge branch 'V1.00' of http://172.1.4.32:3000/CISD/cisd.service into V1.00
This commit is contained in:
commit
00859fed97
27
ukey-tool/src/main/java/com/cisd/ukey/config/WebConfig.java
Normal file
27
ukey-tool/src/main/java/com/cisd/ukey/config/WebConfig.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package com.cisd.ukey.config;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author liulu
|
||||||
|
* @since 2026/4/21
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CorsFilter corsFilter() {
|
||||||
|
CorsConfiguration config = new CorsConfiguration();
|
||||||
|
config.addAllowedOrigin("*"); //允许任意域名跨域访问接口
|
||||||
|
config.addAllowedHeader("*"); // 允许所有头部信息
|
||||||
|
config.addAllowedMethod("*"); // 允许所有请求方法
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
|
source.registerCorsConfiguration("/**", config); // 应用于所有接口
|
||||||
|
return new CorsFilter(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user