Skip to content

Commit

Permalink
fix: 优化扫描器处理逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
AnswerAIL committed Apr 1, 2021
1 parent 49ba203 commit 5852a9a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.github.answerail</groupId>
<artifactId>dinger-spring-boot-starter</artifactId>
<packaging>jar</packaging>
<version>1.1.0</version>
<version>1.1.1</version>

<name>dinger-spring-boot-starter</name>
<description>Dinger-SpringBoot集成钉钉/企业微信群机器人实现消息通知中间件</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -156,7 +156,17 @@ protected List<Class<?>> dingerAnnotationResolver() throws Exception {
if (debugEnabled) {
log.debug("ready to scan package[{}] for Dinger.", basePackage);
}
PackageUtils.classNames(basePackage, dingerClasses, true);
List<Class<?>> 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.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}

Expand Down

0 comments on commit 5852a9a

Please sign in to comment.