将Spring Boot微服务部署到Docker需要ConfigServer?

时间:2019-12-07 02:30:39

标签: spring-boot docker microservices

我想将Spring Boot微服务部署到Docker。 在我的STS中,一切正常,我可以在下面的一些API之间进行调用:

package org.of1.contactservice.client;

import java.util.List;
import java.util.Map;

import org.of1.contactservice.model.Partner;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "partner-service")
public interface PartnerServiceClient {

    @GetMapping("/partner/")
    public List<Partner> getAllPartner();

    @PostMapping("/partner/partnerID/")
    public Partner getPartnerByPartnerID(@RequestBody Map<Object, Object> fields );
}

一切仍然很好,但是当我部署到docker时,我无法调用所有具有FeignClient的API。

以下错误相同:

{
    "timestamp": "2019-12-07T01:23:07.447+0000",
    "message": "e1a9037add3c executing POST http://partner-service/partner/partnerID/",
    "details": "uri=/contact/sales/"
}

我在Internet上发现,当部署到Docker时需要具有ConfigServer,但我不使用它。 有人知道我使用过ConfigServer吗? 如果不需要,该怎么办?

0 个答案:

没有答案