From 5645d01765e0e62e39411e7cb0d091a5e235e9ef Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 11 Mar 2019 09:18:27 +0800 Subject: [PATCH] update --- .../java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java | 7 +++++-- .../zuul/configuration/BaseZuulConfiguration.java | 4 ++-- .../{BaseZuulController.java => ZuulErrorController.java} | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) rename sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/{BaseZuulController.java => ZuulErrorController.java} (95%) diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java index 13c7b25e..b794ab47 100644 --- a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java +++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/ApiConfig.java @@ -15,7 +15,7 @@ import com.gitee.sop.gatewaycommon.validate.ApiValidator; import com.gitee.sop.gatewaycommon.validate.Encrypter; import com.gitee.sop.gatewaycommon.validate.Signer; import com.gitee.sop.gatewaycommon.validate.Validator; -import com.gitee.sop.gatewaycommon.zuul.configuration.BaseZuulController; +import com.gitee.sop.gatewaycommon.zuul.configuration.ZuulErrorController; import com.gitee.sop.gatewaycommon.zuul.param.ZuulParamBuilder; import com.gitee.sop.gatewaycommon.zuul.result.ZuulResultExecutor; import com.netflix.zuul.context.RequestContext; @@ -82,7 +82,10 @@ public class ApiConfig { */ private SessionManager sessionManager = new ApiSessionManager(); - private BaseZuulController baseZuulController = new BaseZuulController(); + /** + * zuul网关全局异常处理 + */ + private ZuulErrorController zuulErrorController = new ZuulErrorController(); /** * 错误模块 diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/BaseZuulConfiguration.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/BaseZuulConfiguration.java index b0f3f228..2f003d1b 100644 --- a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/BaseZuulConfiguration.java +++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/BaseZuulConfiguration.java @@ -76,8 +76,8 @@ public class BaseZuulConfiguration { } @Bean - BaseZuulController baseZuulController() { - return ApiContext.getApiConfig().getBaseZuulController(); + ZuulErrorController baseZuulController() { + return ApiContext.getApiConfig().getZuulErrorController(); } @PostConstruct diff --git a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/BaseZuulController.java b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java similarity index 95% rename from sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/BaseZuulController.java rename to sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java index 5972537f..8d0111ca 100644 --- a/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/BaseZuulController.java +++ b/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody; */ @Controller @Slf4j -public class BaseZuulController implements ErrorController { +public class ZuulErrorController implements ErrorController { public static final String ERROR_PATH = "/error";