| | |
| | | * 这个服务是将 系统部署为spring boot版 |
| | | * 如果是spring cloud 微服务部署 不用启动这个类 |
| | | * <p> |
| | | * excludeName = { |
| | | * "com.java110.intf.acct", |
| | | * "com.java110.intf.code", |
| | | * "com.java110.intf.common", |
| | | * "com.java110.intf.community", |
| | | * "com.java110.intf.demo", |
| | | * "com.java110.intf.dev", |
| | | * "com.java110.intf.fee", |
| | | * "com.java110.intf.goods", |
| | | * "com.java110.intf.job", |
| | | * "com.java110.intf.oa", |
| | | * "com.java110.intf.order", |
| | | * "com.java110.intf.report", |
| | | * "com.java110.intf.store", |
| | | * "com.java110.intf.user" |
| | | * } |
| | | * |
| | | * @version v0.1 |
| | | * @auther com.java110.wuxw |
| | |
| | | "com.java110.user", |
| | | "com.java110.doc", |
| | | "com.java110.scm", |
| | | "com.java110.api", |
| | | "com.java110.boot" |
| | | }, |
| | | 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, |
| | |
| | | @Bean |
| | | public OutRestTemplate outRestTemplate() { |
| | | StringHttpMessageConverter m = new StringHttpMessageConverter(Charset.forName("UTF-8")); |
| | | m.setWriteAcceptCharset(false); |
| | | OutRestTemplate restTemplate = new RestTemplateBuilder().additionalMessageConverters(m).build(OutRestTemplate.class); |
| | | restTemplate.getInterceptors().add(java110RestTemplateInterceptor); |
| | | |
| | |
| | | @LoadBalanced |
| | | public RestTemplate restTemplate() { |
| | | StringHttpMessageConverter m = new StringHttpMessageConverter(Charset.forName("UTF-8")); |
| | | m.setWriteAcceptCharset(false); |
| | | RestTemplate restTemplate = new RestTemplateBuilder().additionalMessageConverters(m).build(RestTemplate.class); |
| | | restTemplate.getInterceptors().add(java110RestTemplateInterceptor); |
| | | //设置超时时间 |
| | | HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(); |
| | | httpRequestFactory.setConnectionRequestTimeout(20000); |
| | | httpRequestFactory.setConnectTimeout(20000); |
| | | httpRequestFactory.setReadTimeout(20000); |
| | | restTemplate.setRequestFactory(httpRequestFactory); |
| | | return restTemplate; |
| | | } |
| | | |
| | |
| | | Java110FeignClientInterceptor okHttpLoggingInterceptor) { |
| | | okhttp3.OkHttpClient.Builder ClientBuilder = new okhttp3.OkHttpClient.Builder() |
| | | .readTimeout(30, TimeUnit.SECONDS) //读取超时 |
| | | .connectTimeout(10, TimeUnit.SECONDS) //连接超时 |
| | | .connectTimeout(20, TimeUnit.SECONDS) //连接超时 |
| | | .writeTimeout(60, TimeUnit.SECONDS) //写入超时 |
| | | .connectionPool(new ConnectionPool(10 /*maxIdleConnections*/, 3, TimeUnit.MINUTES)) |
| | | .connectionPool(new ConnectionPool(20 /*maxIdleConnections*/, 3, TimeUnit.MINUTES)) |
| | | .addInterceptor(okHttpLoggingInterceptor); |
| | | return ClientBuilder.build(); |
| | | } |