Java 假装客户端重复调用远程方法

Java 假装客户端重复调用远程方法,java,Java,我想使用FaignClient调用一个远程方法,但是远程方法是执行重复的,这是我的代码(我不擅长英语,所以请告诉我) 客户: @FeignClient(value = "service", path = "/cdproduct") public interface CdProductClient { @RequestMapping("/cdPost") CdProduct cdPost(@RequestBody CdProductTemplateContext cdProTempCo

我想使用FaignClient调用一个远程方法,但是远程方法是执行重复的,这是我的代码(我不擅长英语,所以请告诉我)

客户:

@FeignClient(value = "service", path = "/cdproduct")
public interface CdProductClient {
@RequestMapping("/cdPost")
CdProduct cdPost(@RequestBody CdProductTemplateContext 
     cdProTempContext) throws BusinessException, SystemException;
}
控制器:

    @RequestMapping("/cdproduct")
    @RestController
    public class CdProductController{
        public CdProduct cdPostProduct(CdProductTemplateContext cdProTempContext, String resPath)
                throws BusinessException, SystemException {

            return cdProductService.cdPostProduct(cdProTempContext, resPath);
        }
        @RequestMapping("/cdPost")
        public CdProduct cdPost(@RequestBody CdProductTemplateContext cdProTempContext, HttpServletRequest request) {
            return cdPostProduct(cdProTempContext, resPath);
        }
    }
serviceImpl:

    @Named("cdProductService")
    public class CdProductServiceImpl implements CdProductService {
        @Override
        public CdProduct cdPostProduct(CdProductTemplateContext 
          cdProTempContext, String resPath) throws BusinessException, SystemException {
        //proPkgRequset: a bean ProductPackageRequest 
         cdProService.submitProductPackage(proPkgRequset);
         //this just invoke method(ICDMarketplaceAPIService.submitProductPackage )

        }
    }
ICDMarketplaceAPIService

@WebService(targetNamespace = "http://www.***.com", name = "IMarketplaceAPIService")
@XmlSeeAlso({ObjectFactory.class})
public interface  ICDMarketplaceAPIService {
    @WebMethod(operationName = "SubmitProductPackage")
    @Action(input = "http://www.***.com/IMarketplaceAPIService/SubmitProductPackage", output = "http://www.***.com/IMarketplaceAPIService/SubmitProductPackageResponse")
    @RequestWrapper(localName = "SubmitProductPackage", targetNamespace = "http://www.***.com", className = "SubmitProductPackage")
    @ResponseWrapper(localName = "SubmitProductPackageResponse", targetNamespace = "http://www.***.com", className = "SubmitProductPackageResponse")
    @WebResult(name = "SubmitProductPackageResult", targetNamespace = "http://www.***.com")
    public ProductIntegrationReportMessage submitProductPackage(
            @WebParam(name = "headerMessage", targetNamespace = "http://www.***.com")
                    HeaderMessage headerMessage,
            @WebParam(name = "productPackageRequest", targetNamespace = "http://www.***.com")
                    ProductPackageRequest productPackageRequest
    );
}

当客户端调用远程方法时,远程方法(controller.cdPost,它是重复执行的),但是如果我删除方法(ICDMarketplaceAPIService.submitProductPackage,或不使用它)或调用其他方法(如query),则可以。发生这种情况的原因是什么,有人能帮我吗?

只需在application.yml中添加以下代码:

ribbon:
  # Max number of retries on the same server (excluding the first try)
  MaxAutoRetries: 0
  # Max number of next servers to retry (excluding the first server)
  MaxAutoRetriesNextServer: 0

只是想知道:为什么用“@Named”注释给出一个大小写不同的名称(以小写字母开头)?这是用于页面的,我认为它不重要,所以没有给出
ribbon:
  # Max number of retries on the same server (excluding the first try)
  MaxAutoRetries: 0
  # Max number of next servers to retry (excluding the first server)
  MaxAutoRetriesNextServer: 0