Spring / Spring7 basics Interview questions
What is the purpose of HTTP Interface clients in Spring?
HTTP Interface clients let you declare a remote service as a plain Java interface annotated with @HttpExchange (and its @GetExchange, @PostExchange shortcuts), and Spring generates a working proxy implementation at runtime - no boilerplate client code to write by hand.
@HttpExchange("/accounts") public interface AccountClient { @GetExchange("/{id}") Account getAccount(@PathVariable int id); }
Behind the scenes, the generated proxy delegates to an underlying RestClient or WebClient, so it inherits whatever interceptors, error handling, and API-versioning configuration that client has. This declarative style mirrors how @FeignClient works in Spring Cloud, but it's built directly into core Spring, with no extra dependency required.
More Related questions...