CareSpringStart.java 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.care;
  2. import com.care.bms.mqtt.MqttInit;
  3. import org.mybatis.spring.annotation.MapperScan;
  4. import org.springframework.boot.SpringApplication;
  5. import org.springframework.boot.autoconfigure.SpringBootApplication;
  6. import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  7. import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
  8. import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
  9. import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
  10. import org.springframework.context.annotation.Bean;
  11. import org.springframework.scheduling.annotation.EnableScheduling;
  12. import org.springframework.web.client.RestTemplate;
  13. /**
  14. * @author little
  15. */
  16. @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
  17. @EnableScheduling
  18. @MapperScan("com.care.**.mapper")
  19. public class CareSpringStart {
  20. public static void main(String[] args) {
  21. SpringApplication.run(CareSpringStart.class, args);
  22. }
  23. @Bean
  24. RestTemplate createTemplate(){
  25. return new RestTemplate();
  26. }
  27. @Bean
  28. public ConfigurableServletWebServerFactory webServerFactory() {
  29. TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
  30. factory.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> connector.setProperty("relaxedQueryChars", "|{}[]"));
  31. return factory;
  32. }
  33. @Bean
  34. public MqttInit mqttInit() {
  35. return new MqttInit();
  36. }
  37. }