Commit 4051f105 by wangnb

订单服务跨域处理--think.wang

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@28357 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 5a0ddbb8
package com.glsx.ordercenter.config; package com.glsx.ordercenter.config;
import java.util.List; import com.glsx.common.interceptor.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry; import org.springframework.format.FormatterRegistry;
...@@ -11,18 +10,9 @@ import org.springframework.validation.Validator; ...@@ -11,18 +10,9 @@ import org.springframework.validation.Validator;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler; import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.glsx.common.interceptor.AuthInterceptor; import java.util.List;
/** /**
* *
...@@ -82,10 +72,17 @@ public class WebConfig implements WebMvcConfigurer{ ...@@ -82,10 +72,17 @@ public class WebConfig implements WebMvcConfigurer{
} }
/**
* 跨域支持
* @param registry
*/
@Override @Override
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
// TODO Auto-generated method stub registry.addMapping("/**")
.allowedOrigins("*")
.allowCredentials(true)
.allowedMethods("GET", "POST", "DELETE", "PUT")
.maxAge(3600 * 24);
} }
@Override @Override
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!