diff --git a/pigx-common/pigx-common-security/src/main/resources/META-INF/spring.factories b/pigx-common/pigx-common-security/src/main/resources/META-INF/spring.factories
index 367df029e..685830eee 100644
--- a/pigx-common/pigx-common-security/src/main/resources/META-INF/spring.factories
+++ b/pigx-common/pigx-common-security/src/main/resources/META-INF/spring.factories
@@ -1,5 +1,4 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
- com.pig4cloud.pigx.common.security.component.GlobalExceptionHandlerResolver,\
com.pig4cloud.pigx.common.security.component.PigxTokenEnhancer,\
com.pig4cloud.pigx.common.security.component.PigxSecurityInnerAspect,\
com.pig4cloud.pigx.common.security.listener.AuthenticationFailureEventListener,\
diff --git a/pigx-common/pigx-common-sentinel/pom.xml b/pigx-common/pigx-common-sentinel/pom.xml
index ddae1da82..7a352506c 100755
--- a/pigx-common/pigx-common-sentinel/pom.xml
+++ b/pigx-common/pigx-common-sentinel/pom.xml
@@ -26,5 +26,10 @@
+ * 全局异常处理器结合sentinel 全局异常处理器不能作用在 oauth server https://gitee.com/log4j/pig/issues/I1M2TJ + *
+ * * @author lengleng - * @date 2018/8/30 全局异常处理器 + * @date 2020-06-29 */ @Slf4j @RestControllerAdvice -public class GlobalExceptionHandlerResolver { +@ConditionalOnExpression("!'${security.oauth2.client.clientId}'.isEmpty()") +public class GlobalBizExceptionHandler { /** * 全局异常. @@ -48,6 +55,9 @@ public class GlobalExceptionHandlerResolver { @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public R handleGlobalException(Exception e) { log.error("全局异常信息 ex={}", e.getMessage(), e); + + // 业务异常交由 sentinel 记录 + Tracer.trace(e); return R.failed(e.getLocalizedMessage()); } diff --git a/pigx-common/pigx-common-sentinel/src/main/resources/META-INF/spring.factories b/pigx-common/pigx-common-sentinel/src/main/resources/META-INF/spring.factories index 550a79f02..b3380d443 100755 --- a/pigx-common/pigx-common-sentinel/src/main/resources/META-INF/spring.factories +++ b/pigx-common/pigx-common-sentinel/src/main/resources/META-INF/spring.factories @@ -1,2 +1,3 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - com.pig4cloud.pigx.common.sentinel.SentinelAutoConfiguration + com.pig4cloud.pigx.common.sentinel.SentinelAutoConfiguration,\ + com.pig4cloud.pigx.common.sentinel.handle.GlobalBizExceptionHandler diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GeneratorServiceImpl.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GeneratorServiceImpl.java index f98c442c5..95867c348 100755 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GeneratorServiceImpl.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GeneratorServiceImpl.java @@ -106,7 +106,6 @@ public class GeneratorServiceImpl implements GeneratorService { List