Spring
Follow
HTTP Service Client Enhancements
Spring Framework 6 introduced HTTP service clients through Java interfaces with `@HttpExchange`, simplifying REST API interaction. However, managing numerous client proxies became repetitive and complex as applications grew. Spring Framework 7 addresses this with an HTTP service registry, improving configuration. This registry offers declarative registration via `@ImportHttpServices` and programmatic registration options. HTTP services are organized into groups sharing client configurations. Configuration utilizes `HttpServiceGroupConfigurer` beans to set client specifics like base URLs. Spring Boot 4.0 provides automatic HTTP client initialization and group-specific properties. Spring Cloud 2025.1 offers load-balancing and circuit-breaking support. Spring Security 7.0 adds OAuth support using the `@ClientRegistrationId` annotation. The HTTP service registry streamlines HTTP client declarations and initialization. This new approach aims to be minimal and widely useful for diverse scenarios. Users are encouraged to test and provide feedback on the new features. Samples for GitHub and StackOverflow clients and Spring Cloud are included.