简化后端配置

This commit is contained in:
kerwincui
2025-03-31 17:36:44 +08:00
parent bc8b5796d2
commit 4065392ccc

View File

@@ -1,16 +1,28 @@
package com.fastbee.mqttclient; package com.fastbee.mqttclient;
import com.fastbee.common.utils.uuid.UUID;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** mqtt配置信息*/ /**
* mqtt配置信息
*/
@Data @Data
@Component @Component
@ConfigurationProperties(prefix = "spring.mqtt")
public class MqttClientConfig { public class MqttClientConfig {
public MqttClientConfig() {
this.username = "fastbee";
this.password = "fastbee";
this.hostUrl = "tcp://127.0.0.1:1883";
this.clientId = UUID.randomUUID().toString();
this.defaultTopic = "test";
this.timeout = 30;
this.keepalive = 30;
this.clearSession = true;
}
/** /**
* 用户名 * 用户名
@@ -41,11 +53,17 @@ public class MqttClientConfig {
*/ */
private int keepalive; private int keepalive;
/**是否清除session*/ /**
* 是否清除session
*/
private boolean clearSession; private boolean clearSession;
/**是否共享订阅*/ /**
* 是否共享订阅
*/
private boolean isShared; private boolean isShared;
/**分组共享订阅*/ /**
* 分组共享订阅
*/
private boolean isSharedGroup; private boolean isSharedGroup;
/** /**