http-interface-clients
/http-interface-clients
Pomaga wywoływać zewnętrzne API ze Spring Boot 4 i Spring Framework 7 przez deklaratywne interfejsy HttpExchange: ImportHttpServices, grupowane adresy bazowe i timeouty oraz wybór między RestClient a WebClient.
- Autor
- rrezartprebreza ↗
- Repozytorium
- spring-boot-skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 22.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 4
- Skrypty
- 2
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 1
Brak sygnałów. Repozytorium zmienione 22.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
- 2 skrypty w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.
Skrypty: examples/bad-order-client.java, examples/good-order-client.java
Co robi i kiedy
Pomaga wywoływać zewnętrzne API ze Spring Boot 4 i Spring Framework 7 przez deklaratywne interfejsy HttpExchange: ImportHttpServices, grupowane adresy bazowe i timeouty oraz wybór między RestClient a WebClient.
Oryginalny opis (EN)
Use when calling external HTTP APIs from Spring Boot 4 / Spring Framework 7 with declarative HttpExchange interfaces. Covers ImportHttpServices, grouped base URLs and timeouts, and RestClient versus WebClient selection.
Jak działa
- Define and register the interface
- Configure groups and transport
- Gotchas
Podgląd SKILL.md
---
name: http-interface-clients
description: >
Use when calling external HTTP APIs from Spring Boot 4 / Spring Framework 7 with declarative
HttpExchange interfaces. Covers ImportHttpServices, grouped base URLs and timeouts, and
RestClient versus WebClient selection.
---
# Declarative HTTP Interface Clients (Boot 4)
Define a remote API as an interface with `@HttpExchange` methods. Boot 4 registers the proxy with
`@ImportHttpServices`, so do not create a manual factory for every client.
## Define and register the interface
```java
@HttpExchange("/orders")
public interface OrderApiClient {
@GetExchange("/{id}")
OrderDto get(@PathVariable UUID id);
@PostExchange
OrderDto create(@RequestBody CreateOrderRequest request);
}
@SpringBootApplication
@ImportHttpServices(group = "orders", basePackages = "com.example.client.orders")
public class Application { }
```
Inject `OrderApiClient` like any other bean. The interface needs no `@Component` and no
implementation class.
## Configure groups and transport
```yaml
spring:
http:
clients:
connect-timeout: 2s
read-timeout: 5s
serviceclient:
orders:
base-url: https://orders.internal.example.com
read-timeout: 10s
```
`spring.http.clients.*` contains global transport defaults. `spring.http.serviceclient.<group>.*`
contains per-group settings, and the group name must match `@ImportHttpServices`.
The default client type is blocking `RestClient`. Select
`HttpServiceGroup.ClientType.WEB_CLIENT` for interfaces returning `Mono` or `Flux`, and include
the WebClient starter. Group configurers apply to a group, not one interface.
Manual `HttpServiceProxyFactory` wiring remains valid for one-off clients, but it is the Boot 3
pattern and should not be the default in Boot 4.
## Gotchas
- Agent creates a `HttpServiceProxyFactory` bean for every client - use `@ImportHttpServices` and groups.
- Agent adds `@Component` or an implementation to the interface - generated proxies need neither.
- Agent uses `spring.http.client.*` - global defaults are under `spring.http.clients.*`; group settings use `serviceclient`.
- Agent hard-codes a host in `@HttpExchange` and sets a group base URL - keep the host in configuration.
- Agent returns `Mono` or `Flux` with the default client - select `WEB_CLIENT` explicitly.
- Agent assumes a group configurer customizes one interface - configure the group or separate the group.
Pliki w paczce (4)
- SKILL.md 2 KB
- agents/openai.yaml 1 KB
- examples/bad-order-client.java 1 KB
- examples/good-order-client.java 1 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · rrezartprebreza/spring-boot-skills | 100 | MIT |
| rrezartprebreza/spring-boot-skills | 100 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki db80c8034e9d (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100spring-testing-http-client
Testuje kod wywołujący zewnętrzne API w Spring Boot: RestClient, klienty HTTP, MockRestServiceServer i błędy odpowiedzi. - 100spring-cloud-openfeign
Wspiera deklaratywnego klienta HTTP Spring Cloud OpenFeign dla komunikacji mikroserwisów: @FeignClient, obsługa błędów, interceptory i integracja z circuit breakerem. - 100spring-web
Wspiera Spring Web MVC w Spring Boot 3.x: RestClient, WebClient, ResponseEntity, interceptory, negocjacja treści, przesyłanie plików, odpowiedzi strumieniowe i własne resolvery argumentów. - 100spring-boot-web-api
Wspiera implementację REST API w Spring Boot 4: kontrolery, walidacja żądań, ProblemDetail (RFC 9457), wersjonowanie API, WebFlux, klienty @HttpExchange, Jackson 3 i CORS. - 95restclient-migration
Migruje RestTemplate na RestClient w Spring Boot 3.2 i nowszych: przejście na płynne API, konfiguracja beanów, migracje GET, POST i DELETE, obsługa błędów i ParameterizedTypeReference. - 100spring-boot-expert
Wspiera pracę z Spring Boot, Spring Framework, API REST i mikroserwisami w Javie.