Skip to content
Back to skills

Http Interface Clients

ASecurity

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.

  • 272 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 6, 2026
ai-agentsgojavaspringapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add rrezartprebreza/spring-boot-skills --skill http-interface-clients --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Http Interface Clients?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Http Interface Clients
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/rrezartprebreza-http-interface-clients-spring-boot-skills/badge)](https://www.skillsdirectory.com/skills/rrezartprebreza-http-interface-clients-spring-boot-skills)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
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.

Files in this skill

  • SKILL.md2.4 KB
  • agents/openai.yaml204 B
  • examples/bad-order-client.java154 B
  • examples/good-order-client.java256 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.