https://github.com/DanielLiu1123/httpexchange-spring-boot-starter
The missing starter for Spring 6 declarative HTTP client (@HttpExchange).
https://github.com/DanielLiu1123/httpexchange-spring-boot-starter
declarative-http-client graalvm http-client java jdk17 native-image spring-boot spring-boot-starter spring-cloud spring6
Last synced: 5 days ago
JSON representation
The missing starter for Spring 6 declarative HTTP client (@HttpExchange).
- Host: GitHub
- URL: https://github.com/DanielLiu1123/httpexchange-spring-boot-starter
- Owner: DanielLiu1123
- License: mit
- Created: 2023-01-08T06:18:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-23T11:32:28.000Z (about 1 month ago)
- Last Synced: 2026-03-24T09:02:26.683Z (about 1 month ago)
- Topics: declarative-http-client, graalvm, http-client, java, jdk17, native-image, spring-boot, spring-boot-starter, spring-cloud, spring6
- Language: Java
- Homepage: https://danielliu1123.github.io/httpexchange-spring-boot-starter/
- Size: 2.45 MB
- Stars: 54
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-java - HttpExchange Spring Boot Starter
README
#
HttpExchange Spring Boot Starter [](https://github.com/DanielLiu1123/httpexchange-spring-boot-starter/actions) [](https://search.maven.org/artifact/io.github.danielliu1123/httpexchange-spring-boot-starter) [](https://opensource.org/licenses/MIT)
Spring 6 now supports creating HTTP clients using the [`@HttpExchange`](https://docs.spring.io/spring-framework/reference/integration/rest-clients.html#rest-http-interface) annotation.
This removes the need for [Spring Cloud OpenFeign](https://github.com/spring-cloud/spring-cloud-openfeign).
The main goals of this project are:
- To promote `@HttpExchange` as the standard for defining API interfaces.
- To offer an experience similar to `Spring Cloud OpenFeign` for declarative HTTP clients.
- To avoid external annotations, making it easier to switch to other implementations.
> [!NOTE]\
> Spring Boot 4.x has supported automatic registration of `@HttpExchange` interfaces. However, the current official implementation still suffers from unnecessary repetition and verbosity.
> Therefore, this project will continue to be maintained, offering a cleaner, more elegant, and more ergonomic alternative until the Spring Boot team gets it right.
## Quick Start
Spring Boot >= 4.0.0:
```groovy
implementation("org.springframework.boot:spring-boot-starter-restclient") // use RestClient as underlying http client
// implementation("org.springframework.boot:spring-boot-starter-webclient") // use WebClient as underlying http client
implementation("io.github.danielliu1123:httpexchange-spring-boot-starter:")
```
Spring Boot < 4.0.0:
```groovy
implementation("io.github.danielliu1123:httpexchange-spring-boot-starter:3.5.5")
```
```java
@HttpExchange("https://my-json-server.typicode.com")
interface PostApi {
@GetExchange("/typicode/demo/posts/{id}")
Post getPost(@PathVariable("id") int id);
}
@SpringBootApplication
@EnableExchangeClients
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
@Bean
ApplicationRunner runner(PostApi api) {
return args -> api.getPost(1);
}
}
```
Refer to [quick-start](examples/quick-start).
## Documentation
Go to [Reference Documentation](https://danielliu1123.github.io/httpexchange-spring-boot-starter/docs/intro) for more information.
## Code of Conduct
This project is governed by the [Code of Conduct](./CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code of conduct.
Please report unacceptable behavior to llw599502537@gmail.com.
## Contributing
Use the [issue tracker](https://github.com/DanielLiu1123/httpexchange-spring-boot-starter/issues) for bug reports,
feature requests, and submitting pull requests.
If you would like to contribute to the project, please refer to [Contributing](./CONTRIBUTING.md).
## License
The MIT License.
## Special Thanks
Many thanks to [JetBrains](https://www.jetbrains.com/) for sponsoring this Open Source project with a license.