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