微服务架构中不同微服务之间的接口调用

假定系统管理微服务的实例名称为system,

在系统管理中查询码表 :/api/system/codeTable/queryDataDictionaryByDicCode

 

 

在自己的微服务中调用系统管理的查询码表接口写法如下:


DataDictionaryService

@AuthorizedFeignClient(name = "system",fallback = DataDictionaryServiceImpl.class)
public interface DataDictionaryService extends BaseService {

    /**
     * 根据dic_key获取value
     * @param dto
     * @return
     */
    @RequestMapping(method= RequestMethod.POST,value="/api/system/codeTable/queryDataDictionaryByDicCode",consumes = "application/json")
    ResponseDTO queryDataDictionaryByDicCode(@RequestBody DataDictionaryDTO dto);

}

----------------------------------------------------------------------------------------------------------------------------

DataDictionaryServiceImpl

@Service
public class DataDictionaryServiceImpl implements DataDictionaryService {

    @Override
    public ResponseDTO queryDataDictionaryByDicCode(DataDictionaryDTO dto) {
        return new ResponseDTO("300","system==queryDataDictionaryByDicCode==调用失败");
    }
}

你可能感兴趣的:(微服务架构中不同微服务之间的接口调用)