package com.xynet.pay; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.cache.annotation.EnableCaching; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.feign.EnableFeignClients; import org.springframework.cloud.netflix.hystrix.EnableHystrix; import org.springframework.context.annotation.Bean; import org.springframework.retry.annotation.EnableRetry; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.transaction.annotation.EnableTransactionManagement; import java.util.TimeZone; import java.util.concurrent.Executor; import java.util.concurrent.ThreadPoolExecutor; @EnableCaching //开启缓存 @SpringBootApplication @EnableHystrix @ServletComponentScan @EnableTransactionManagement @EnableDiscoveryClient @EnableFeignClients @EnableScheduling @EnableAsync @EnableRetry @MapperScan(basePackages = {"com.xynet.pay.meitu.mapper"}) public class XynetServicePayThirdApplication { public static void main(String[] args) { init(); SpringApplication.run(XynetServicePayThirdApplication.class, args); } private static void init(){ //设置时区 System.setProperty("user.timezone","Asia/Shanghai"); TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai")); } /** * 公共日志执行线程池配置 * * @return */ @Bean(value = "publicLogTaskExecutor") public Executor publicLogTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setThreadNamePrefix("PublicLogTaskExecutor"); executor.setCorePoolSize(10); executor.setQueueCapacity(200); executor.setMaxPoolSize(100); executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy()); executor.initialize(); return executor; } }