http-interface-clients
Skill293 starsChanged 4 months agoMITView on GitHub
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.
In this repository65 other files it gives its agents.
- ai-observabilitySkill
- api-versioningSkill
- configuration-propertiesSkill
- container-native-deploymentSkill
- domain-driven-designSkill
- event-driven-messagingSkill
- flyway-migrationsSkill
- hateoasSkill
- hexagonal-architectureSkill
- http-interface-clientsSkill
- idempotency-patternsSkill
- layered-architectureSkill
- mcp-serverSkill
- multi-module-mavenSkill
- multi-tenancySkill
- null-safetySkill
- oauth2-resource-serverSkill
- openapi-firstSkill
- problem-details-rfc9457Skill
- production-observabilitySkill
- resilience-retrySkill
- rest-api-conventionsSkill
- spring-ai-integrationSkill
- spring-batchSkill
- spring-boot-migrationSkill
- spring-cloud-gatewaySkill
- spring-data-jpaSkill
- spring-data-redisSkill
- spring-modulithSkill
- spring-security-jwtSkill
- testing-pyramidSkill
- transactional-patternsSkill
- webflux-reactive-patternsSkill
- ai-observabilitySkill
- api-versioningSkill
- configuration-propertiesSkill
- container-native-deploymentSkill
- domain-driven-designSkill
- event-driven-messagingSkill
- flyway-migrationsSkill
- hateoasSkill
- hexagonal-architectureSkill
- idempotency-patternsSkill
- layered-architectureSkill
- mcp-serverSkill
- multi-module-mavenSkill
- multi-tenancySkill
- null-safetySkill
- oauth2-resource-serverSkill
- openapi-firstSkill
- problem-details-rfc9457Skill
- production-observabilitySkill
- resilience-retrySkill
- rest-api-conventionsSkill
- spring-ai-integrationSkill
- spring-batchSkill
- spring-boot-migrationSkill
- spring-cloud-gatewaySkill
- spring-data-jpaSkill
- spring-data-redisSkill
- The first 60 shown.
The file
Files
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
@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
spring:
http:
clients:
connect-timeout: 2s
read-timeout: 5s
serviceclient:
orders:
base-url: https://orders.internal.example.com
read-timeout: 10sspring.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
HttpServiceProxyFactorybean for every client - use@ImportHttpServicesand groups. - Agent adds
@Componentor an implementation to the interface - generated proxies need neither. - Agent uses
spring.http.client.*- global defaults are underspring.http.clients.*; group settings useserviceclient. - Agent hard-codes a host in
@HttpExchangeand sets a group base URL - keep the host in configuration. - Agent returns
MonoorFluxwith the default client - selectWEB_CLIENTexplicitly. - Agent assumes a group configurer customizes one interface - configure the group or separate the group.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

