| | |
| | | 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.http.client.HttpComponentsClientHttpRequestFactory; |
| | | import org.springframework.http.converter.StringHttpMessageConverter; |
| | | import org.springframework.scheduling.annotation.EnableAsync; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.nio.charset.Charset; |
| | |
| | | }, |
| | | exclude = {LiquibaseAutoConfiguration.class, |
| | | org.activiti.spring.boot.SecurityAutoConfiguration.class, |
| | | org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class} |
| | | org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class, |
| | | com.github.pagehelper.autoconfigure.MapperAutoConfiguration.class |
| | | } |
| | | |
| | | ) |
| | | @Java110CmdDiscovery(cmdPublishClass = ServiceCmdEventPublishing.class, |
| | |
| | | "com.java110.scm.cmd", |
| | | "com.java110.user.cmd" |
| | | }) |
| | | @EnableScheduling |
| | | @EnableAsync |
| | | //文档 |
| | | @Java110ApiDocDiscovery(basePackages = {"com.java110.boot.rest"}, apiDocClass = ApiDocPublishing.class) |
| | |
| | | |
| | | //设置超时时间 |
| | | HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(); |
| | | httpRequestFactory.setConnectionRequestTimeout(5000); |
| | | httpRequestFactory.setConnectTimeout(5000); |
| | | httpRequestFactory.setReadTimeout(5000); |
| | | httpRequestFactory.setConnectionRequestTimeout(10000); |
| | | httpRequestFactory.setConnectTimeout(10000); |
| | | httpRequestFactory.setReadTimeout(10000); |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * 实例化RestTemplate,通过@LoadBalanced注解开启均衡负载能力. |
| | | * |
| | |
| | | |
| | | 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); |