# retrofit2-spring
**Repository Path**: msimw/retrofit2-spring
## Basic Information
- **Project Name**: retrofit2-spring
- **Description**: Http 接口调用API框架(对httpclient的封装基于OkHttp3),支持接口泛型注入。调用http接口就像调用本地接口一样简单(不用编写实现类)。
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: https://msimw.gitbooks.io/retrofit2-spring/content/
- **GVP Project**: No
## Statistics
- **Stars**: 52
- **Forks**: 20
- **Created**: 2017-09-18
- **Last Updated**: 2023-11-26
## Categories & Tags
**Categories**: web-dev-toolkits
**Tags**: None
## README
## retrofit2 with spring
Http 接口调用API(对httpclient的封装基于OkHttp3),支持接口泛型注入。调用http接口就像调用本地接口一样简单(不用编写实现类)
### 文档地址 https://msimw.gitbooks.io/retrofit2-spring/content/
### Maven
com.github.msimw
retrofit2-spring
1.1
### 版本更新说明
v1.4 1.支持用户自定义httpapi资源文件
2.新增对cookie配置
3.支持https配置
4.支持自定义dns配置
5.支持缓存配置
### 功能描述
1.与spring整合,将httpApi 交由spring容器管理(逆向mvc),支持IOC
2.支持接口继承+泛型注入
3.支持直接返回结果对象
### 简单使用
#### 1.配置文件
#### 2.接口
public interface IPushHttpApi {
@POST("b")
public String push();
}
@HttpApi("http://www.baidu.com/")
public interface IBaiduPushHttpApi extends IPushHttpApi{
}
#### 3.Junit
public class DemoTest {
@Autowired
private IPushHttpApi pushHttpApi;
@Test
public void oneTest() throws IOException {
this.pushHttpApi.push();
}
}