Fetch the repository succeeded.
This action will force synchronization from msimw/retrofit2-spring, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
Http 接口调用API(对httpclient的封装基于OkHttp3),支持接口泛型注入。调用http接口就像调用本地接口一样简单(不用编写实现类)
<dependency>
<groupId>com.github.msimw</groupId>
<artifactId>retrofit2-spring</artifactId>
<version>1.1</version>
</dependency>
v1.4 1.支持用户自定义httpapi资源文件
2.新增对cookie配置
3.支持https配置
4.支持自定义dns配置
5.支持缓存配置
1.与spring整合,将httpApi 交由spring容器管理(逆向mvc),支持IOC
2.支持接口继承+泛型注入
3.支持直接返回结果对象
<!--http连接池配置-->
<bean id="httpDataSource" class="com.msimw.retrofit2x.spring.HttpDataSource">
<property name="maxIdleConnections" value="${httpclient.maxIdleConnection}"></property>
<property name="keepAliveDurationNs" value="${httpclient.keepAliveDuration}"></property>
<property name="connTimeOut" value="${httpclient.connTimeOut}"></property>
<property name="readTimeOut" value="${httpclient.readTimeOut}"></property>
<property name="writeTimeOut" value="${httpclient.writeTimeOut}"></property>
</bean>
<!--http扫包配置-->
<bean class="com.msimw.retrofit2x.spring.HttpApiScannerConfigurer">
<!--与spring扫包配置一样-->
<property name="basePackage" value="com"></property>
</bean>
public interface IPushHttpApi<T> {
@POST("b")
public String push();
}
@HttpApi("http://www.baidu.com/")
public interface IBaiduPushHttpApi extends IPushHttpApi<String>{
}
public class DemoTest {
@Autowired
private IPushHttpApi<String> pushHttpApi;
@Test
public void oneTest() throws IOException {
this.pushHttpApi.push();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。