@FeignClient名称参数(服务ID),末尾有相对url

时间:2017-05-30 17:17:42

标签: spring-cloud spring-cloud-netflix netflix-feign spring-cloud-feign

我最近在春季启动项目中开始使用Feign。 当我的假装客户端使用服务发现和使用eureka和功能区进行负载平衡(目标服务分布在群集中的多个节点上)时,我有一个关于场景的问题。我希望有一个这样的假装客户端界面:

SELECT a.Property_ExternalID, a.Lease_ExternalID, a.Amount AS 'Min_Amount', b.Amount AS 'Max_Amount'
FROM #Temp a
INNER JOIN 
(
    SELECT Property_ExternalID, Lease_ExternalID, MIN(Date) AS MinDate 
    FROM #Temp 
    GROUP BY  Property_ExternalID, Lease_ExternalID
) x ON a.Property_ExternalID = x.Property_ExternalID AND a.Lease_ExternalID = x.Lease_ExternalID AND a.Date = x.MinDate
INNER JOIN #Temp b ON a.Property_ExternalID = b.Property_ExternalID AND a.Lease_ExternalID = b.Lease_ExternalID
INNER JOIN 
(
    SELECT Property_ExternalID, Lease_ExternalID, MAX(Date) AS MaxDate 
    FROM #Temp 
    GROUP BY  Property_ExternalID, Lease_ExternalID
) y ON b.Property_ExternalID = y.Property_ExternalID AND b.Lease_ExternalID = y.Lease_ExternalID AND b.Date = y.MaxDate

有没有办法将name参数(targetServiceId)的值与“/ common-url-part”“混合”,以避免在我的界面中为每个方法替换注释中的相同url部分?

1 个答案:

答案 0 :(得分:0)

您可以尝试path这样的属性:

@FeignClient(name="targetServiceId", path = "/common-url-part/")

应该这样做,至少说明似乎很有希望:FeignClient