The missing starter for Spring 6 declarative HTTP client (@HttpExchange).
See the code
HttpExchange Spring Boot Starter Spring 6 now supports creating HTTP clients using the @HttpExchange annotation.
This removes the need for Spring Cloud OpenFeign.
The main goals of this project are:
@HttpExchange as the standard for defining API interfaces.Spring Cloud OpenFeign for declarative HTTP clients.[!NOTE]
Spring Boot 4.x has supported automatic registration of@HttpExchangeinterfaces. 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.
Spring Boot >= 4.0.0:
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:<latest>")
Spring Boot < 4.0.0:
implementation("io.github.danielliu1123:httpexchange-spring-boot-starter:3.5.5")
@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.
Go to Reference Documentation for more information.
This project is governed by the Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to [email protected].
Use the issue tracker for bug reports, feature requests, and submitting pull requests.
If you would like to contribute to the project, please refer to Contributing.
The MIT License.
Many thanks to JetBrains for sponsoring this Open Source project with a license.
Latest release
Releases this year
1,271 followers · starred Nov 2024
1,455 followers · starred Nov 2024
19 followers · starred Aug 2024
The missing starter for Spring 6 declarative HTTP client (@HttpExchange).
See the code
HttpExchange Spring Boot Starter Spring 6 now supports creating HTTP clients using the @HttpExchange annotation.
This removes the need for Spring Cloud OpenFeign.
The main goals of this project are:
@HttpExchange as the standard for defining API interfaces.Spring Cloud OpenFeign for declarative HTTP clients.[!NOTE]
Spring Boot 4.x has supported automatic registration of@HttpExchangeinterfaces. 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.
Spring Boot >= 4.0.0:
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:<latest>")
Spring Boot < 4.0.0:
implementation("io.github.danielliu1123:httpexchange-spring-boot-starter:3.5.5")
@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.
Go to Reference Documentation for more information.
This project is governed by the Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to [email protected].
Use the issue tracker for bug reports, feature requests, and submitting pull requests.
If you would like to contribute to the project, please refer to Contributing.
The MIT License.
Many thanks to JetBrains for sponsoring this Open Source project with a license.
Latest release
Releases this year
1,271 followers · starred Nov 2024
1,455 followers · starred Nov 2024
19 followers · starred Aug 2024