Skip to content

Commit

Permalink
fix:fix feign report -1 port bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyeBeFreeman committed Aug 8, 2023
1 parent 51504c2 commit 264b654
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

<properties>
<!-- Project revision -->
<revision>1.11.8-Hoxton.SR12</revision>
<revision>1.11.9-Hoxton.SR12</revision>

<!-- Spring Framework -->
<spring.framework.version>5.2.22.RELEASE</spring.framework.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = DEFINED_PORT,
classes = EncodeTransferMedataFeignInterceptorTest.TestApplication.class,
properties = {"server.port=8081",
properties = {"server.port=18081",
"spring.config.location = classpath:application-test.yml",
"spring.main.web-application-type = servlet",
"spring.cloud.gateway.enabled = false"})
Expand Down Expand Up @@ -77,7 +77,7 @@ public String test() {
return MetadataContextHolder.get().getContext(MetadataContext.FRAGMENT_TRANSITIVE, "b");
}

@FeignClient(name = "test-feign", url = "http://localhost:8081")
@FeignClient(name = "test-feign", url = "http://localhost:18081")
public interface TestFeign {

@RequestMapping("/test")
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-tencent-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</developers>

<properties>
<revision>1.11.8-Hoxton.SR12</revision>
<revision>1.11.9-Hoxton.SR12</revision>

<!-- Dependencies -->
<polaris.version>1.12.11</polaris.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public Response execute(Request request, Options options) throws IOException {

DefaultServiceInstance serviceInstance = new DefaultServiceInstance(request.requestTemplate().feignTarget()
.name(), url.getHost(), url.getPort(), url.getScheme().equals("https"));
// -1 means access directly by url, and use http default port number 80
serviceInstance.setPort(serviceInstance.getPort() == -1 ? 80 : serviceInstance.getPort());
enhancedPluginContext.setServiceInstance(serviceInstance);

// Run post enhanced plugins.
Expand Down

0 comments on commit 264b654

Please sign in to comment.