
01 引言
之前分享过一篇文章【像调用接口一样调用第三方API】,今天迎来了新成员Retrofit。
retrofit-spring-boot-starter 是一个基于 Spring Boot 的 starter,它简化了 Retrofit 在 Spring 环境中的集成和使用。Retrofit 本身是一个类型安全的 HTTP 客户端库,而该 starter 让其能够无缝融入 Spring Boot 项目,提供自动配置、依赖注入等特性。
GitHub地址:https://github.com/LianjiaTech/retrofit-spring-boot-starter
Gitee地址:https://gitee.com/lianjiatech/retrofit-spring-boot-starter

02 依赖
本文采用的是retrofit-spring-boot-starter 3.2.0,SpringBoot的版本影响着依赖的引入。

<dependency>
<groupId>com.github.lianjiatech</groupId>
<artifactId>retrofit-spring-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
03 最佳实践
3.1 基础配置
接口必须使用@R

最低0.47元/天 解锁文章
1882

被折叠的 条评论
为什么被折叠?



