diff --git a/pom.xml b/pom.xml index e4aff5c..4e577cc 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.github.answerail dinger-spring-boot-starter jar - 1.1.0 + 1.1.1 dinger-spring-boot-starter Dinger-SpringBoot集成钉钉/企业微信群机器人实现消息通知中间件 diff --git a/src/main/java/com/github/jaemon/dinger/core/AbstractDingerDefinitionResolver.java b/src/main/java/com/github/jaemon/dinger/core/AbstractDingerDefinitionResolver.java index a9aeb4e..77a1f41 100644 --- a/src/main/java/com/github/jaemon/dinger/core/AbstractDingerDefinitionResolver.java +++ b/src/main/java/com/github/jaemon/dinger/core/AbstractDingerDefinitionResolver.java @@ -22,7 +22,6 @@ import com.github.jaemon.dinger.core.annatations.Parameter; import com.github.jaemon.dinger.core.entity.enums.DingerDefinitionType; import com.github.jaemon.dinger.core.entity.enums.DingerType; -import com.github.jaemon.dinger.core.entity.enums.ExceptionEnum; import com.github.jaemon.dinger.exception.DingerException; import com.github.jaemon.dinger.listeners.DingerListenersProperty; import com.github.jaemon.dinger.utils.PackageUtils; @@ -38,6 +37,7 @@ import java.util.List; import static com.github.jaemon.dinger.core.AbstractDingerDefinitionResolver.Container.INSTANCE; +import static com.github.jaemon.dinger.core.ClassPathScanForResources.*; import static com.github.jaemon.dinger.core.entity.enums.ExceptionEnum.*; import static com.github.jaemon.dinger.utils.DingerUtils.methodParamsGenericType; import static com.github.jaemon.dinger.utils.DingerUtils.methodParamsType; @@ -156,7 +156,17 @@ protected List> dingerAnnotationResolver() throws Exception { if (debugEnabled) { log.debug("ready to scan package[{}] for Dinger.", basePackage); } - PackageUtils.classNames(basePackage, dingerClasses, true); + List> classes = scanInterfaces(basePackage); + if (!classes.isEmpty()) { + dingerClasses.addAll(classes); + } + } + + if (dingerClasses.isEmpty()) { + log.warn("the first time to parse the packages[{}] is empty.", Arrays.asList(basePackages)); + for (String basePackage : basePackages) { + PackageUtils.classNames(basePackage, dingerClasses, true); + } } } else { log.warn("annotation dingerScan is not configured and will execute Dinger scanner registrar."); diff --git a/src/main/java/com/github/jaemon/dinger/utils/PackageUtils.java b/src/main/java/com/github/jaemon/dinger/utils/PackageUtils.java index 73d9012..28ab758 100644 --- a/src/main/java/com/github/jaemon/dinger/utils/PackageUtils.java +++ b/src/main/java/com/github/jaemon/dinger/utils/PackageUtils.java @@ -143,8 +143,13 @@ public static void forClassNames( } } } catch (Exception ex) { - log.error("when analysis packageName={} catch exception=", - packageName, ex); + if (log.isDebugEnabled()) { + log.error("when analysis packageName={} catch exception=", + packageName, ex); + } else { + log.warn("when analysis packageName={} catch exception={}.", + packageName, ex.getMessage()); + } } }