| 
					
				 | 
			
			
				@@ -0,0 +1,31 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package com.jeeplus.config; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.context.annotation.Configuration; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.servlet.config.annotation.CorsRegistry; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @author: 徐滕 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @version: 2022-07-11 14:23 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Configuration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class CorsConfig implements WebMvcConfigurer { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void addCorsMappings(CorsRegistry registry){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //设置允许跨域的路径 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        registry.addMapping ("/**") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .allowedOrigins("http://bx.xgccpm.com/") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //设置允许跨域请求的域名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .allowedOriginPatterns ("http://bx.xgccpm.com/") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //是否允许证书 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .allowCredentials (true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //设置允许的方法 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .allowedMethods ("POST", "GET", "PATCH", "DELETE", "PUT") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //设置允许的header属性 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .allowedHeaders ("*") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //允许跨域时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .maxAge (3600); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |