Application.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.dashitech;
  2. import org.atmosphere.cpr.AtmosphereServlet;
  3. import org.springframework.boot.SpringApplication;
  4. import org.springframework.boot.autoconfigure.SpringBootApplication;
  5. import org.springframework.boot.web.servlet.ServletRegistrationBean;
  6. import org.springframework.context.annotation.Bean;
  7. import org.springframework.context.annotation.ImportResource;
  8. import org.springframework.context.annotation.PropertySource;
  9. import org.springframework.core.Ordered;
  10. import org.springframework.scheduling.annotation.EnableAsync;
  11. import org.springframework.scheduling.annotation.EnableScheduling;
  12. import java.text.SimpleDateFormat;
  13. import java.util.Date;
  14. //import org.mybatis.spring.annotation.MapperScan;
  15. @SpringBootApplication
  16. @EnableAsync
  17. @EnableScheduling
  18. @PropertySource({"classpath:application-custom.properties", "application.properties"})
  19. @ImportResource(locations = "classpath*:/application-context.xml")
  20. //@Import({DynamicDataSourceRegister.class}) // 注册动态多数据源
  21. //@MapperScan("com.dashitech.dao.mysqldb1")//将项目中对应的mapper类的路径加进来就可以了
  22. public class Application {
  23. @Bean
  24. public ServletRegistrationBean camelWebSocketServlet() {
  25. ServletRegistrationBean bean = new ServletRegistrationBean(new AtmosphereServlet(), "/webSocket/*");
  26. bean.setName("phoneWebSocket");
  27. bean.setLoadOnStartup(0);
  28. bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
  29. return bean;
  30. }
  31. public static void main(String[] args) {
  32. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  33. System.out.println("hsmsV1-CallSocket>>>>>>>>>>>>>>>>>>startData"+sdf.format(new Date()));
  34. SpringApplication.run(Application.class, args);
  35. }
  36. }