package cn.jx.wechat.app.wechatrobot.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; @Configuration(proxyBeanMethods=true) public class RestfulConfig { //默认RestTemplate配置工厂(采用httpclient) @Bean("defaultAppRestFactory") public HttpComponentsClientHttpRequestFactory defaultAppRestFactory(RestProperties restProperties) { return new ComponentsHttpClientConfigBuilder() .restProperties(restProperties) .conProp(restProperties.getMaster()) .build(); } @Bean("c") public RestTemplate appRestTemplate() { } }