From fcfa66100c5e15d261f59d5982795eb3796b6d35 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 25 Jun 2022 15:17:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E7=A7=BB=E9=99=A4=20mall-spr?= =?UTF-8?q?ing-boot-starter-sentry=20=E7=9A=84=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall-spring-boot-starter-sentry/pom.xml | 25 ------------ .../config/CustomSentryAutoConfiguration.java | 39 ------------------- .../resolver/DoNothingExceptionResolver.java | 32 --------------- .../main/resources/META-INF/spring.factories | 2 - 4 files changed, 98 deletions(-) delete mode 100644 归档/common/mall-spring-boot-starter-sentry/pom.xml delete mode 100644 归档/common/mall-spring-boot-starter-sentry/src/main/java/cn/iocoder/mall/sentry/config/CustomSentryAutoConfiguration.java delete mode 100644 归档/common/mall-spring-boot-starter-sentry/src/main/java/cn/iocoder/mall/sentry/resolver/DoNothingExceptionResolver.java delete mode 100644 归档/common/mall-spring-boot-starter-sentry/src/main/resources/META-INF/spring.factories diff --git a/归档/common/mall-spring-boot-starter-sentry/pom.xml b/归档/common/mall-spring-boot-starter-sentry/pom.xml deleted file mode 100644 index 54c0edd9d..000000000 --- a/归档/common/mall-spring-boot-starter-sentry/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - common - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - mall-spring-boot-starter-sentry - - - - io.sentry - sentry-spring-boot-starter - - - io.sentry - sentry-logback - - - - \ No newline at end of file diff --git a/归档/common/mall-spring-boot-starter-sentry/src/main/java/cn/iocoder/mall/sentry/config/CustomSentryAutoConfiguration.java b/归档/common/mall-spring-boot-starter-sentry/src/main/java/cn/iocoder/mall/sentry/config/CustomSentryAutoConfiguration.java deleted file mode 100644 index 771139bea..000000000 --- a/归档/common/mall-spring-boot-starter-sentry/src/main/java/cn/iocoder/mall/sentry/config/CustomSentryAutoConfiguration.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.mall.sentry.config; - -import cn.iocoder.mall.sentry.resolver.DoNothingExceptionResolver; -import io.sentry.spring.SentryExceptionResolver; -import io.sentry.spring.autoconfigure.SentryAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.HandlerExceptionResolver; - -/** - * 自定义的 Sentry 自动配置类 - * - * @author Hccake 2020/8/6 - * @version 1.0 - */ -@ConditionalOnClass({HandlerExceptionResolver.class, SentryExceptionResolver.class}) -@ConditionalOnWebApplication -@ConditionalOnProperty(name = "sentry.enabled", havingValue = "true", matchIfMissing = true) -@Configuration(proxyBeanMethods = false) -public class CustomSentryAutoConfiguration { - - /** - * 用于覆盖原有的 SentryStarter 提供的 SentryExceptionResolver 操作 - * 解决使用 log appender 形式推送错误信息与全局异常捕获导致重复推送的情况 - * - * @return DoNothingExceptionResolver - */ - @Bean - @ConditionalOnClass(SentryAutoConfiguration.class) - @ConditionalOnMissingBean(SentryExceptionResolver.class) - public SentryExceptionResolver doNothingExceptionResolver() { - return new DoNothingExceptionResolver(); - } - -} diff --git a/归档/common/mall-spring-boot-starter-sentry/src/main/java/cn/iocoder/mall/sentry/resolver/DoNothingExceptionResolver.java b/归档/common/mall-spring-boot-starter-sentry/src/main/java/cn/iocoder/mall/sentry/resolver/DoNothingExceptionResolver.java deleted file mode 100644 index 6cd0ac8e7..000000000 --- a/归档/common/mall-spring-boot-starter-sentry/src/main/java/cn/iocoder/mall/sentry/resolver/DoNothingExceptionResolver.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.mall.sentry.resolver; - -import io.sentry.spring.SentryExceptionResolver; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * 默认什么也不做的 SentryExceptionResolver - * - * @author Hccake 2020/8/6 - * @version 1.0 - */ -public class DoNothingExceptionResolver extends SentryExceptionResolver { - - @Override - public ModelAndView resolveException(HttpServletRequest request, - HttpServletResponse response, - Object handler, - Exception ex) { - // do nothing here - - // null = run other HandlerExceptionResolvers to actually handle the exception - return null; - } - - @Override - public int getOrder() { - return Integer.MIN_VALUE; - } -} \ No newline at end of file diff --git a/归档/common/mall-spring-boot-starter-sentry/src/main/resources/META-INF/spring.factories b/归档/common/mall-spring-boot-starter-sentry/src/main/resources/META-INF/spring.factories deleted file mode 100644 index befade37d..000000000 --- a/归档/common/mall-spring-boot-starter-sentry/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -cn.iocoder.mall.sentry.config.CustomSentryAutoConfiguration