feign Read timed out

feign调用超时 不知道各位有没有遇到过这种问题: 在调用feign接口的时候一直加载。。。(因为配置了ribbon超时时间的原因) 然后ribbon时

feign调用超时

不知道各位有没有遇到过这种问题:

在调用feign接口的时候一直加载。。。(因为配置了ribbon超时时间的原因)
在这里插入图片描述
然后ribbon时间一到就报错
在这里插入图片描述
在网上找了原因说是配上ribbon的超时时间就可以了(这里已经配了!!)

接下来看feign接口怎么实现的

@FeignClient(name = "center-goods-service", contextId = "tempTransferOldDataToNewTable", path = "api-asyncTempTransferOldDataToNewTableService")
public interface TempTransferOldDataToNewTableService {/*** 迁移供应商信息*/@PostMapping("/transferGoodsSupplierInfo")public void transferGoodsSupplierInfo();
}

这里 name代表的服务名称
contextId 就是注册到spring容器的名字(只有一个 center-goods-service可以省略)
path 代表的请求的路径

然后我们看接口实现

@Service
@Slf4j
public class TempTransferOldDataToNewTableServiceImpl implements TempTransferOldDataToNewTableService {@Resourceprivate TempTransferOldDataToNewTableMapper tempTransferOldDataToNewTableMapper;@Resourceprivate WideApiGoodsServiceImpl wideApiGoodsService;private final static String GOODS_IMGES = "view_goods_product_image";private final static String GOODS_LOGS = "view_goods_operation_log";private final static String GOODS_FEI = "view_goods_fee_info";public void transferSkuBasicInfo() {this.tempTransferOldDataToNewTableMapper.selectDataFromSanvnProductDevelopmentTable();}
}

貌似一看没什么问题
但是我们调用却出现刚开始的问题

怎么解决?
其实就是feign接口里面的路径没有在实现中展示我们这样改就可以了

@Service
@RestController
@RequestMapping("/api-asyncTempTransferOldDataToNewTableService")
public class TempTransferOldDataToNewTableServiceImpl implements TempTransferOldDataToNewTableService {@Resourceprivate TempTransferOldDataToNewTableMapper tempTransferOldDataToNewTableMapper;@Resourceprivate WideApiGoodsServiceImpl wideApiGoodsService;private final static String GOODS_IMGES = "view_goods_product_image";private final static String GOODS_LOGS = "view_goods_operation_log";private final static String GOODS_FEI = "view_goods_fee_info";public void transferSkuBasicInfo() {this.tempTransferOldDataToNewTableMapper.selectDataFromSanvnProductDevelopmentTable();}
}

然后我们打个断点测试一下在这里插入图片描述
断点进来了,说明可以了。