diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java index 7a4d0583..d5457a0d 100644 --- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java @@ -29,6 +29,7 @@ import cn.hutool.core.util.StrUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import java.util.List; import java.util.Map; @@ -42,6 +43,7 @@ import java.util.stream.Collectors; * @date 2022/2/25 00:24 */ @AllArgsConstructor +@Slf4j public class CoreNotifyConfigBuilder implements NotifyConfigBuilder { private final AlarmControlHandler alarmControlHandler; @@ -53,14 +55,16 @@ public class CoreNotifyConfigBuilder implements NotifyConfigBuilder { Map> resultMap = Maps.newHashMap(); boolean globalAlarm = bootstrapCoreProperties.getAlarm(); List executors = bootstrapCoreProperties.getExecutors(); + if (CollectionUtil.isEmpty(executors)) { + log.error("Failed to buildNotify,executors configuration is empty"); + return resultMap; + } List actual = executors.stream().filter(each -> Optional.ofNullable(each.getNotify()).map(notify -> notify.getIsAlarm()).orElse(false)).collect(Collectors.toList()); if (!globalAlarm && CollectionUtil.isEmpty(actual)) { return resultMap; } - if (CollectionUtil.isNotEmpty(executors)) { - for (ExecutorProperties executor : executors) { - resultMap.putAll(buildSingleNotifyConfig(executor)); - } + for (ExecutorProperties executor : executors) { + resultMap.putAll(buildSingleNotifyConfig(executor)); } return resultMap; }