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 jdk17 native-image reactive spring-boot spring-boot-starter spring-cloud spring6
Last synced: 2 months 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 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-25T17:16:52.000Z (8 months ago)
- Last Synced: 2024-10-12T16:13:00.627Z (7 months ago)
- Topics: declarative-http-client, graalvm, http-client, jdk17, native-image, reactive, spring-boot, spring-boot-starter, spring-cloud, spring6
- Language: Java
- Homepage: https://danielliu1123.github.io/httpexchange-spring-boot-starter/
- Size: 1.86 MB
- Stars: 28
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
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 ensure compatibility with Spring web annotations like `@RequestMapping` and `@GetMapping`.
- To avoid external annotations, making it easier to switch to other implementations.## Quick Start
```groovy
implementation("io.github.danielliu1123:httpexchange-spring-boot-starter:")
``````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 [email protected].## 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.