PoyeeDashboardApplication.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package com.poyee;
  2. import lombok.extern.slf4j.Slf4j;
  3. import org.springframework.boot.SpringApplication;
  4. import org.springframework.boot.autoconfigure.SpringBootApplication;
  5. import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
  6. import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  7. import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
  8. import org.springframework.context.annotation.Bean;
  9. import org.springframework.context.annotation.EnableAspectJAutoProxy;
  10. import org.springframework.scheduling.annotation.EnableAsync;
  11. import org.springframework.scheduling.annotation.EnableScheduling;
  12. import org.springframework.transaction.annotation.EnableTransactionManagement;
  13. import java.util.TimeZone;
  14. /**
  15. * 项目启动
  16. */
  17. @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, SecurityAutoConfiguration.class }
  18. , scanBasePackages = {"com.poyee"})
  19. @EnableAsync
  20. @EnableAspectJAutoProxy(proxyTargetClass = true)
  21. @EnableTransactionManagement
  22. @EnableScheduling
  23. @Slf4j
  24. public class PoyeeDashboardApplication {
  25. private static final String APPLICATION_TIME_ZONE = "Asia/Shanghai";
  26. public static void main(String[] args) {
  27. configureApplicationTimeZone();
  28. SpringApplication.run(PoyeeDashboardApplication.class, args);
  29. log.info("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙");
  30. }
  31. static void configureApplicationTimeZone() {
  32. TimeZone.setDefault(TimeZone.getTimeZone(APPLICATION_TIME_ZONE));
  33. }
  34. @Bean
  35. public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() {
  36. return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder
  37. .timeZone(TimeZone.getTimeZone(APPLICATION_TIME_ZONE))
  38. .simpleDateFormat("yyyy-MM-dd HH:mm:ss");
  39. }
  40. }