Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

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.

Licencja
MIT
Ostatnia zmiana repozytorium
22.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
4
Skrypty
2
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 22.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 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

  1. Define and register the interface
  2. Configure groups and transport
  3. Gotchas
Sekcje z nagłówków SKILL.md, w oryginale · 59 linii, 269 słów
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

RepozytoriumWynikLicencja
Ta strona · rrezartprebreza/spring-boot-skills100MIT
rrezartprebreza/spring-boot-skills100MIT

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.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.