|
|
@@ -4,14 +4,18 @@ import com.dtflys.forest.springboot.annotation.ForestScan;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
+import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
|
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
|
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
|
|
|
import org.springframework.cache.annotation.EnableCaching;
|
|
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
import org.springframework.context.annotation.FilterType;
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
|
|
|
+import java.util.TimeZone;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 启动程序
|
|
|
@@ -29,8 +33,22 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
@Slf4j
|
|
|
@EnableFeignClients(basePackages = "com.tzy.openfeign")
|
|
|
public class PoyiApplication {
|
|
|
+ private static final String APPLICATION_TIME_ZONE = "Asia/Shanghai";
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
+ configureApplicationTimeZone();
|
|
|
SpringApplication.run(PoyiApplication.class, args);
|
|
|
log.info("(♥◠‿◠)ノ゙ app启动成功 ლ(´ڡ`ლ)゙");
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ static void configureApplicationTimeZone() {
|
|
|
+ TimeZone.setDefault(TimeZone.getTimeZone(APPLICATION_TIME_ZONE));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() {
|
|
|
+ return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder
|
|
|
+ .timeZone(TimeZone.getTimeZone(APPLICATION_TIME_ZONE))
|
|
|
+ .simpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ }
|
|
|
+}
|