| | |
| | | import com.java110.doc.registrar.ApiDocPublishing; |
| | | import com.java110.intf.dev.ICacheV1InnerServiceSMO; |
| | | import com.java110.service.init.ServiceStartInit; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.constant.MappingConstant; |
| | | import com.java110.utils.factory.ApplicationContextFactory; |
| | | import com.java110.utils.util.StringUtil; |
| | | import okhttp3.ConnectionPool; |
| | |
| | | import org.springframework.cloud.client.loadbalancer.LoadBalanced; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
| | | import org.springframework.http.converter.StringHttpMessageConverter; |
| | | import org.springframework.scheduling.annotation.EnableAsync; |
| | | |
| | |
| | | "com.java110.store", |
| | | "com.java110.user", |
| | | "com.java110.doc", |
| | | "com.java110.scm", |
| | | "com.java110.boot" |
| | | }, |
| | | exclude = {LiquibaseAutoConfiguration.class, |
| | |
| | | "com.java110.order.cmd", |
| | | "com.java110.report.cmd", |
| | | "com.java110.store.cmd", |
| | | "com.java110.scm.cmd", |
| | | "com.java110.user.cmd" |
| | | }) |
| | | @EnableAsync |
| | |
| | | "com.java110.order.cmd", |
| | | "com.java110.report.cmd", |
| | | "com.java110.store.cmd", |
| | | "com.java110.scm.cmd", |
| | | "com.java110.user.cmd" |
| | | }, |
| | | cmdDocClass = ApiDocCmdPublishing.class) |
| | |
| | | public OutRestTemplate outRestTemplate() { |
| | | StringHttpMessageConverter m = new StringHttpMessageConverter(Charset.forName("UTF-8")); |
| | | OutRestTemplate restTemplate = new RestTemplateBuilder().additionalMessageConverters(m).build(OutRestTemplate.class); |
| | | restTemplate.getInterceptors().add(java110RestTemplateInterceptor); |
| | | |
| | | //设置超时时间 |
| | | HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(); |
| | | httpRequestFactory.setConnectionRequestTimeout(5000); |
| | | httpRequestFactory.setConnectTimeout(5000); |
| | | httpRequestFactory.setReadTimeout(5000); |
| | | restTemplate.setRequestFactory(httpRequestFactory); |
| | | return restTemplate; |
| | | } |
| | | |
| | | @Bean |
| | | //@LoadBalanced |
| | | public RestTemplate formRestTemplate() { |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | restTemplate.getMessageConverters().add(new StringHttpMessageConverter(Charset.forName("UTF-8"))); |
| | | return restTemplate; |
| | | } |
| | | |
| | |
| | | |
| | | Environment.setSystemStartWay(Environment.SPRING_BOOT); |
| | | |
| | | |
| | | //刷新缓存 |
| | | flushMainCache(args); |
| | | |
| | | //服务启动完成 |
| | | ServiceStartInit.printStartSuccessInfo(); |
| | | |
| | | |
| | | } catch (Throwable e) { |
| | | logger.error("系统启动失败", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 刷新主要的缓存 |
| | |
| | | logger.debug("判断是否需要刷新日志,参数 args 为 {}", args); |
| | | |
| | | //因为好多朋友启动时 不加 参数-Dcache 所以启动时检测 redis 中是否存在 java110_hc_version |
| | | //String mapping = MappingCache.getValue("java110_hc_version"); |
| | | //String mapping = MappingCache.getValue(MappingConstant.ENV_DOMAIN,"java110_hc_version"); |
| | | String mapping = ""; |
| | | if (StringUtil.isEmpty(mapping)) { |
| | | ICacheV1InnerServiceSMO devServiceCacheSMOImpl = (ICacheV1InnerServiceSMO) ApplicationContextFactory.getBean(ICacheV1InnerServiceSMO.class); |