提交 abac0914 编写于 作者: 浅梦2013's avatar 浅梦2013

mica-mqtt client stater 优化。

上级 4e4aa50a
......@@ -19,6 +19,7 @@ package net.dreamlu.iot.mqtt.spring.client;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.dreamlu.iot.mqtt.core.client.IMqttClientMessageListener;
import net.dreamlu.iot.mqtt.core.util.TopicUtil;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
......@@ -94,7 +95,12 @@ public class MqttClientSubscribeDetector implements BeanPostProcessor {
}
private static String[] getTopicFilters(ApplicationContext applicationContext, String[] values) {
return Arrays.stream(values).map(applicationContext.getEnvironment()::resolvePlaceholders).toArray(String[]::new);
// 1. 替换 Spring boot env 变量
// 2. 替换订阅中的其他变量
return Arrays.stream(values)
.map(applicationContext.getEnvironment()::resolvePlaceholders)
.map(TopicUtil::getTopicFilter)
.toArray(String[]::new);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册