diff --git a/pom.xml b/pom.xml
index c71481c..6ade2cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
com.github.answerail
dinger-spring-boot-starter
jar
- 1.0.0
+ 1.0.1
dinger-spring-boot-starter
Dinger-SpringBoot集成钉钉/企业微信群机器人实现消息通知中间件
diff --git a/src/main/java/com/github/jaemon/dinger/core/DingerConfig.java b/src/main/java/com/github/jaemon/dinger/core/DingerConfig.java
index 9670b64..b58d42b 100644
--- a/src/main/java/com/github/jaemon/dinger/core/DingerConfig.java
+++ b/src/main/java/com/github/jaemon/dinger/core/DingerConfig.java
@@ -55,6 +55,17 @@ private DingerConfig(String tokenId, String secret) {
this.secret = secret;
}
+ private DingerConfig(String tokenId, String secret, boolean async) {
+ this.tokenId = tokenId;
+ this.secret = secret;
+ this.asyncExecute = async;
+ }
+
+ private DingerConfig(DingerType dingerType, String tokenId, String secret, boolean async) {
+ this(tokenId, secret, async);
+ this.dingerType = dingerType;
+ }
+
private DingerConfig(DingerType dingerType, String tokenId, String secret) {
this(tokenId, secret);
this.dingerType = dingerType;
@@ -93,42 +104,194 @@ private DingerConfig(DingerType dingerType, String tokenId, String secret, Strin
this.dingerType = dingerType;
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param tokenId
+ * 机器人tokenID
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(String tokenId) {
return new DingerConfig(tokenId);
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param dingerType
+ * Dinger机器人类型, {@link DingerType}, MultiDinger中无需指定
+ * @param tokenId
+ * 机器人tokenID
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(DingerType dingerType, String tokenId) {
return new DingerConfig(dingerType, tokenId);
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param tokenId
+ * 机器人tokenID
+ * @param secret
+ * 机器人签名秘钥
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(String tokenId, String secret) {
return new DingerConfig(tokenId, secret);
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param dingerType
+ * Dinger机器人类型, {@link DingerType}, MultiDinger中无需指定
+ * @param tokenId
+ * 机器人tokenID
+ * @param secret
+ * 机器人签名秘钥
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(DingerType dingerType, String tokenId, String secret) {
return new DingerConfig(dingerType, tokenId, secret);
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param tokenId
+ * 机器人tokenID
+ * @param asyncExecute
+ * 是否异步发送
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(String tokenId, boolean asyncExecute) {
return new DingerConfig(tokenId, asyncExecute);
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param dingerType
+ * Dinger机器人类型, {@link DingerType}, MultiDinger中无需指定
+ * @param tokenId
+ * 机器人tokenID
+ * @param asyncExecute
+ * 是否异步发送
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(DingerType dingerType, String tokenId, boolean asyncExecute) {
return new DingerConfig(dingerType, tokenId, asyncExecute);
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param tokenId
+ * 机器人tokenID
+ * @param secret
+ * 机器人签名秘钥
+ * @param asyncExecute
+ * 是否异步发送
+ * @return
+ * 机器人配置实例
+ */
+ public static DingerConfig instance(String tokenId, String secret, boolean asyncExecute) {
+ return new DingerConfig(tokenId, secret, asyncExecute);
+ }
+
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param dingerType
+ * Dinger机器人类型, {@link DingerType}, MultiDinger中无需指定
+ * @param tokenId
+ * 机器人tokenID
+ * @param secret
+ * 机器人签名秘钥
+ * @param asyncExecute
+ * 是否异步发送
+ * @return
+ * 机器人配置实例
+ */
+ public static DingerConfig instance(DingerType dingerType, String tokenId, String secret, boolean asyncExecute) {
+ return new DingerConfig(dingerType, tokenId, secret, asyncExecute);
+ }
+
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param tokenId
+ * 机器人tokenID
+ * @param secret
+ * 机器人签名秘钥
+ * @param decryptKey
+ * Dinger组件内部解密秘钥
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(String tokenId, String secret, String decryptKey) {
return new DingerConfig(tokenId, secret, decryptKey);
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param dingerType
+ * Dinger机器人类型, {@link DingerType}, MultiDinger中无需指定
+ * @param tokenId
+ * 机器人tokenID
+ * @param secret
+ * 机器人签名秘钥
+ * @param decryptKey
+ * Dinger组件内部解密秘钥
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(DingerType dingerType, String tokenId, String secret, String decryptKey) {
return new DingerConfig(dingerType, tokenId, secret, decryptKey);
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param tokenId
+ * 机器人tokenID
+ * @param secret
+ * 机器人签名秘钥
+ * @param decryptKey
+ * Dinger组件内部解密秘钥
+ * @param asyncExecute
+ * 是否异步发送
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(String tokenId, String secret, String decryptKey, boolean asyncExecute) {
return new DingerConfig(tokenId, secret, decryptKey, asyncExecute);
}
+ /**
+ * Dinger机器人配置实例
+ *
+ * @param dingerType
+ * Dinger机器人类型, {@link DingerType}, MultiDinger中无需指定
+ * @param tokenId
+ * 机器人tokenID
+ * @param secret
+ * 机器人签名秘钥
+ * @param decryptKey
+ * Dinger组件内部解密秘钥
+ * @param asyncExecute
+ * 是否异步发送
+ * @return
+ * 机器人配置实例
+ */
public static DingerConfig instance(DingerType dingerType, String tokenId, String secret, String decryptKey, boolean asyncExecute) {
return new DingerConfig(dingerType, tokenId, secret, decryptKey, asyncExecute);
}
@@ -222,7 +385,7 @@ public void setSecret(String secret) {
}
public Boolean getAsyncExecute() {
- return asyncExecute;
+ return asyncExecute == null ? false : asyncExecute;
}
public void setAsyncExecute(Boolean asyncExecute) {
diff --git a/src/main/java/com/github/jaemon/dinger/core/DingerHandleProxy.java b/src/main/java/com/github/jaemon/dinger/core/DingerHandleProxy.java
index f2225dc..12f140e 100644
--- a/src/main/java/com/github/jaemon/dinger/core/DingerHandleProxy.java
+++ b/src/main/java/com/github/jaemon/dinger/core/DingerHandleProxy.java
@@ -71,7 +71,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
DingerType useDinger = dingerType(method);
DingerDefinition dingerDefinition = dingerDefinition(
- useDinger, keyName
+ useDinger, dingerClassName, keyName
);
if (dingerDefinition == null) {
return null;
diff --git a/src/main/java/com/github/jaemon/dinger/core/DingerMessageHandler.java b/src/main/java/com/github/jaemon/dinger/core/DingerMessageHandler.java
index 200b9d2..625c5a4 100644
--- a/src/main/java/com/github/jaemon/dinger/core/DingerMessageHandler.java
+++ b/src/main/java/com/github/jaemon/dinger/core/DingerMessageHandler.java
@@ -148,12 +148,14 @@ DingerType dingerType(Method method) {
*
* @param useDinger
* 代理方法使用的Dinger
+ * @param dingerClassName
+ * 代理类全限定名
* @param keyName
- * keyName
+ * 代理方法全限定名
* @return
* dingerDefinition {@link DingerDefinition}
*/
- DingerDefinition dingerDefinition(DingerType useDinger, String keyName) {
+ DingerDefinition dingerDefinition(DingerType useDinger, String dingerClassName, String keyName) {
DingerDefinition dingerDefinition;
DingerConfig localDinger = DingerHelper.getLocalDinger();
@@ -173,7 +175,7 @@ DingerDefinition dingerDefinition(DingerType useDinger, String keyName) {
if (multiDinger()) {
MultiDingerConfig multiDingerConfig =
MultiDingerConfigContainer
- .INSTANCE.get(useDinger, keyName);
+ .INSTANCE.get(useDinger, dingerClassName);
DingerConfig dingerConfig = null;
if (multiDingerConfig != null) {
// 拿到MultiDingerConfig中当前应该使用的DingerConfig