package com.keao.edu.user; import com.huifu.adapay.Adapay; import com.huifu.adapay.model.MerConfig; import com.keao.edu.thirdparty.adapay.ConfigInit; import com.keao.edu.user.service.NotifyCallback; import com.spring4all.swagger.EnableSwagger2Doc; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.web.client.RestTemplate; @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients({"com.keao.edu"}) @MapperScan({"com.keao.edu.user.dao"}) @ComponentScan(basePackages="com.keao.edu") @Configuration @EnableSwagger2Doc @EnableAsync public class UserServerApplication { public static void main(String[] args) { SpringApplication.run(UserServerApplication.class, args); } @Bean @LoadBalanced public RestTemplate restTemplate() { return new RestTemplate(); } @Bean public static void startMqtt() { MerConfig merConfig = ConfigInit.merConfig; NotifyCallback notifyCallback = new NotifyCallback(); try { Adapay.startMqttListener(merConfig, notifyCallback); } catch (Exception e) { e.printStackTrace(); } } }