Repolode
LianjiaTech

LianjiaTech/retrofit-spring-boot-starter

A Spring Boot starter that turns Retrofit HTTP interfaces into Spring-managed beans with added features like retry, logging, and circuit breaking.

Stars
1,916
Forks
338
Open issues
8
Last commit
2 months ago

What is it?

retrofit-spring-boot-starter lets you define HTTP APIs as plain Java interfaces annotated with @RetrofitClient, then inject them into Spring services like any other bean. It builds on Retrofit's native annotations for requests, so the familiar @GET, @POST, @Query, @Body and related annotations work as they do in Retrofit itself.

Beyond basic integration, the starter adds configurable features such as automatic response adaptation, custom converters, method-level timeouts, request retry, interceptors, circuit breaking and degradation, error decoders, and Micrometer metrics. Clients can be scanned automatically or registered explicitly with @RetrofitScan.

The project targets Spring Boot 3.x and 4.x and requires JDK 17 or later. Spring Boot 1.x and 2.x projects are served by the separate 2.x branch.

Key features

  • 01Define HTTP clients as Java interfaces using Retrofit's native annotations.
  • 02Automatic registration of clients via Spring component scanning or @RetrofitScan.
  • 03Method-level timeout, retry, and circuit-breaking configuration.
  • 04Custom converters, interceptors, and error decoders.
  • 05Micrometer metrics and Spring Boot Actuator endpoints.
  • 06Support for GraalVM Native Image and AOT builds.

Use cases

  • Calling third-party REST APIs from a Spring Boot service with retries and timeouts.
  • Building typed internal microservice clients inside a Spring Boot application.
  • Adding logging, metrics, and circuit breaking to outbound HTTP calls without hand-written plumbing.

Quick start

  1. 1

    Add the starter dependency (retrofit-spring-boot-starter 4.2.1) to your pom.xml

  2. 2

    Define an interface annotated with @RetrofitClient and Retrofit HTTP annotations

  3. 3

    Inject the interface into a Spring service with @Autowired and call it

Things to know

  • Requires JDK 17 or newer.
  • Spring Boot 1.x and 2.x projects must use the separate 2.x branch of the starter.

In collections

Topics

FAQ

What is retrofit-spring-boot-starter?
A Spring Boot starter that turns Retrofit HTTP interfaces into Spring-managed beans with added features like retry, logging, and circuit breaking. retrofit-spring-boot-starter lets you define HTTP APIs as plain Java interfaces annotated with @RetrofitClient, then inject them into Spring services like any other bean. It builds on Retrofit's native annotations for requests, so the familiar @GET, @POST, @Query, @Body and related annotations work as they do in Retrofit itself.
Is retrofit-spring-boot-starter free to use? What license does it have?
retrofit-spring-boot-starter is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is retrofit-spring-boot-starter still maintained?
Updated within 6 months. The last commit to retrofit-spring-boot-starter was on Sep 14, 2026.
What can I use retrofit-spring-boot-starter for?
Calling third-party REST APIs from a Spring Boot service with retries and timeouts. Building typed internal microservice clients inside a Spring Boot application. Adding logging, metrics, and circuit breaking to outbound HTTP calls without hand-written plumbing.
How do I install retrofit-spring-boot-starter?
Add the starter dependency (retrofit-spring-boot-starter 4.2.1) to your pom.xml Define an interface annotated with @RetrofitClient and Retrofit HTTP annotations Inject the interface into a Spring service with @Autowired and call it
Where can I get retrofit-spring-boot-starter?
The source code and installation instructions are on GitHub: https://github.com/LianjiaTech/retrofit-spring-boot-starter

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects