package com.xyhy.jiaranmqttcluster; import com.xyhy.jiaranmqttcluster.common.Common; import com.xyhy.jiaranmqttcluster.common.mqtt.MqttServer; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @Component public class ServerRun extends Common implements CommandLineRunner { @Override public void run(String... args) throws Exception { //MQTT server 启动 MqttServer.getInstance().connect(); } }