/**/

package net.shapelight;

//import net.shapelight.modules.dev.mqtt.MqttClientUtil;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.commons.engine.sdk.PalmSDK;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Slf4j
//@ImportResource(value = { "classpath:spring/spring.xml" })
@SpringBootApplication//(exclude = DataSourceAutoConfiguration.class)//排除DataSourceConfiguratrion
@EnableCaching
@EnableTransactionManagement
@ServletComponentScan
//@MapperScan("net.shapelight.modules.sys.dao")
public class AdminApplication {

	public static void main(String[] args) {
		SpringApplication.run(AdminApplication.class, args);

		//初始化掌静脉sdk
		int initCode = PalmSDK.init();
		log.debug("掌静脉sdk初始化。。。。。。。。。。:"+initCode);
//		//mqtt服务启动
//		MqttClientUtil.createClient();
//
		Runtime.getRuntime().addShutdownHook(new Thread() {
			@Override
			public void run() {
				try {
					int code = PalmSDK.release();
					log.debug("掌静脉sdk释放。。。。。。。。。。:"+code);
				} catch (Throwable e) {
					e.printStackTrace();
				}
			}
		});
	}

}