From c64c2c623bf1041dc7f0b9ff92ebbf562466951c Mon Sep 17 00:00:00 2001 From: smallchill Date: Mon, 18 Nov 2019 23:27:14 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E9=92=89=E9=92=89=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/springblade/admin/config/AdminConfiguration.java | 9 +++++++++ .../org/springblade/admin/notifier/CustomNotifier.java | 2 -- blade-ops/blade-admin/src/main/resources/bootstrap.yml | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/blade-ops/blade-admin/src/main/java/org/springblade/admin/config/AdminConfiguration.java b/blade-ops/blade-admin/src/main/java/org/springblade/admin/config/AdminConfiguration.java index 3da8d50d..23c16910 100644 --- a/blade-ops/blade-admin/src/main/java/org/springblade/admin/config/AdminConfiguration.java +++ b/blade-ops/blade-admin/src/main/java/org/springblade/admin/config/AdminConfiguration.java @@ -18,6 +18,8 @@ package org.springblade.admin.config; import com.alibaba.cloud.nacos.NacosDiscoveryProperties; import com.alibaba.cloud.nacos.discovery.NacosWatch; +import de.codecentric.boot.admin.server.domain.entities.InstanceRepository; +import org.springblade.admin.notifier.CustomNotifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; @@ -38,4 +40,11 @@ public class AdminConfiguration { return new NacosWatch(nacosDiscoveryProperties); } + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(value = "spring.boot.admin.notify.dingtalk.enabled", havingValue = "true") + public CustomNotifier customNotifier(InstanceRepository repository) { + return new CustomNotifier(repository); + } + } diff --git a/blade-ops/blade-admin/src/main/java/org/springblade/admin/notifier/CustomNotifier.java b/blade-ops/blade-admin/src/main/java/org/springblade/admin/notifier/CustomNotifier.java index cd40dba6..9de5afe3 100644 --- a/blade-ops/blade-admin/src/main/java/org/springblade/admin/notifier/CustomNotifier.java +++ b/blade-ops/blade-admin/src/main/java/org/springblade/admin/notifier/CustomNotifier.java @@ -27,7 +27,6 @@ import de.codecentric.boot.admin.server.domain.events.InstanceStatusChangedEvent import de.codecentric.boot.admin.server.notify.AbstractEventNotifier; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; import reactor.core.publisher.Mono; @@ -42,7 +41,6 @@ import reactor.core.publisher.Mono; * @author jeckxu */ @Slf4j -@Component public class CustomNotifier extends AbstractEventNotifier { /** diff --git a/blade-ops/blade-admin/src/main/resources/bootstrap.yml b/blade-ops/blade-admin/src/main/resources/bootstrap.yml index 0713fac1..9ceb8d3b 100644 --- a/blade-ops/blade-admin/src/main/resources/bootstrap.yml +++ b/blade-ops/blade-admin/src/main/resources/bootstrap.yml @@ -19,4 +19,5 @@ spring: - serverAddr notify: dingtalk: + enabled: false webhook-token: Your DingDing Robot Token