|
@@ -1,28 +1,28 @@
|
1
|
|
-package com.yunzhi.marketing.config;
|
2
|
|
-
|
3
|
|
-import org.springframework.context.annotation.Bean;
|
4
|
|
-import org.springframework.context.annotation.Configuration;
|
5
|
|
-import org.springframework.web.cors.CorsConfiguration;
|
6
|
|
-import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
7
|
|
-import org.springframework.web.filter.CorsFilter;
|
8
|
|
-
|
9
|
|
-
|
10
|
|
- * 解决跨域问题
|
11
|
|
- */
|
12
|
|
-@Configuration
|
13
|
|
-public class CorsConfig {
|
14
|
|
- private CorsConfiguration buildConfig() {
|
15
|
|
- CorsConfiguration corsConfiguration = new CorsConfiguration();
|
16
|
|
- corsConfiguration.addAllowedOrigin("*");
|
17
|
|
- corsConfiguration.addAllowedHeader("*");
|
18
|
|
- corsConfiguration.addAllowedMethod("*");
|
19
|
|
- return corsConfiguration;
|
20
|
|
- }
|
21
|
|
-
|
22
|
|
- @Bean
|
23
|
|
- public CorsFilter corsFilter() {
|
24
|
|
- UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
25
|
|
- source.registerCorsConfiguration("/**", buildConfig());
|
26
|
|
- return new CorsFilter(source);
|
27
|
|
- }
|
28
|
|
-}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|