{"repo":"LianjiaTech/retrofit-spring-boot-starter","free":true,"listed":false,"github":"https://github.com/LianjiaTech/retrofit-spring-boot-starter","clone":"git clone https://github.com/LianjiaTech/retrofit-spring-boot-starter.git","description":"A spring-boot starter for retrofit, supports rapid integration and feature enhancements.（适用于retrofit的spring-boot-starter，支持快速集成和功能增强）","language":"Java","stars":1913,"topics":["java","retrofit","http","okhttp3","spring-boot"],"license":"Apache-2.0","category":"saas-starters-boilerplates","readme_excerpt":"retrofit-spring-boot-starter English 简体中文 繁體中文 日本語 한국어 Español Türkçe Русский Retrofit 支持将 HTTP API 化成 Java 接口，本组件将 Retrofit 和 Spring Boot 深度整合，并支持了多种实用功能增强。 - Spring Boot 3.x/4.x 项目 ，请使用 retrofit-spring-boot-starter 4.x - 由于 Spring Boot 4.x 默认使用 Jackson 3，而本组件默认 Converter 使用 Jackson 2，因此 4.x 项目建议将全局 Converter 设置为 Jackson 3 - 配置方式： retrofit.global-converter-factories=com.github.lianjiatech.retrofit.spring.boot.core.jackson3.Jackson3ConverterFactory - Spring Boot 1.x/2.x 项目 ，请使用 retrofit-spring-boot-starter 2.x，支持 Spring Boot 1.4.2 及以上版本 项目持续优化迭代，欢迎大家提 ISSUE 和 PR！能给一颗 star，是对我们持续更新的最大支持！ GitHub：https://github.com/LianjiaTech/retrofit-spring-boot-starter Gitee：https://gitee.com/lianjiatech/retrofit-spring-boot-starter 快速开始 引入依赖 引入依赖后即可使用。如遇问题，参见常见问题。 定义 HTTP 接口 接口必须使用 @RetrofitClient 注解标记！ 注意： 方法请求路径慎用 / 开头 。Retrofit 的路径拼接规则：如果 baseUrl = http://localhost:8080/api/test/ ，方法路径 person 的完整路径为 http://localhost:8080/api/test/person ；而方法路径 /person 的完整路径为 http://localhost:8080/person 。 注入使用 将接口注入到其他 Service 中即可使用： 默认情况下，自动使用 SpringBoot 扫描路径进行 RetrofitClient 注册，也可以在配置类加上 @RetrofitScan 手动指定扫描路径。 HTTP 请求注解 HTTP 请求相关注解全部使用 Retrofit 原生注解： 注解分类 支持的注解 ---------- ----------- 请求方式 @GET @HEAD @POST @PUT @DELETE @OPTIONS @HTTP 请求头 @Header @HeaderMap @Headers Query 参数 @Query @QueryMap @QueryName Path 参数 @Path Form 参数 @Field @FieldMap @FormUrlEncoded 请求体 @Body 文件上传 @Multipart @Part @PartMap URL 参数 @Url 详细信息参考 Retrofit 官方文档 功能特性 - [x] HTTP 响应结果自动适配 - [x] 自定义数据转换器 - [x] 自定义 OkHttpClient 与 Call.Factor","default_branch":null,"files":null,"tree":[],"storefront":"/r/LianjiaTech","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/LianjiaTech/retrofit-spring-boot-starter/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}