liulin
2025-07-02 b9f0f641b85bbbfe74fc23efe4f4965586d9e3af
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.lunhan.water.host.mqtt;
 
 
 
import com.lunhan.water.common.config.MqttConfig;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
 
import java.util.Objects;
 
@Component
@Order(40)
public class MQTTStart implements InitializingBean {
    @Autowired
    private MQTTSubsribe mqttSubsribe;
    @Autowired
    private MqttConfig mqttConfig;
 
    @Override
    public void afterPropertiesSet() throws Exception {
        if (Objects.equals(mqttConfig.getEnable(), Boolean.FALSE)) {
            return;
        }
        mqttSubsribe.init();
    }
}