spring-cloud-commons icon indicating copy to clipboard operation
spring-cloud-commons copied to clipboard

LoadBalancerRestClientHttpServiceGroupConfigurer does not set baseUrl for @ImportHttpServices groups

Open goalfy1030 opened this issue 3 weeks ago • 1 comments

Description:

Environment

  • Spring Boot: 4.0.0
  • Spring Cloud: 2025.1.0
  • Spring Cloud Alibaba: 2025.1.0.0-SNAPSHOT

Problem

When using @ImportHttpServices with a service discovery name, the LoadBalancerRestClientHttpServiceGroupConfigurer does not set the baseUrl correctly, resulting in "Target host is not specified" error.

Configuration

@ImportHttpServices(group = "traffic-service", types = TrafficFeignService.class)
@SpringBootApplication
public class LinkApplication { }

@HttpExchange
public interface TrafficFeignService {
    @PostExchange("/api/traffic/v1/reduce")
    JsonData useTraffic(@RequestBody UseTrafficRequest request);
}

Expected

The LoadBalancerRestClientHttpServiceGroupConfigurer should automatically set
baseUrl = "http://traffic-service" based on the group name.

Actual

Caused by: org.apache.hc.core5.http.ProtocolException: Target host is not specified

Workaround

Manually create the HTTP Service proxy with @LoadBalanced RestClient.Builder.

---

goalfy1030 avatar Dec 06 '25 13:12 goalfy1030

I am not able to reproduce this

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

ryanjbaxter avatar Dec 10 '25 17:12 ryanjbaxter

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues avatar Dec 17 '25 17:12 spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-cloud-issues avatar Dec 24 '25 17:12 spring-cloud-issues