我的Feign是继承模式实现的,content里UserCenterFeignClient继承user里的UserCenterFeignClientService
package com.zengchen.content.feignclient;
import com.zengchen.user.client.service.UserCenterFeignClientService;
import org.springframework.cloud.openfeign.FeignClient;
//@FeignClient(name = "user-center",configuration = UserCenterFeignClientConfiguration.class)
@FeignClient(name = "user-center")
public interface UserCenterFeignClient
extends UserCenterFeignClientService
{
/**
* FeignClient的name + GetMapping的value
* 相当于 http://user-center/reciteHis/testAno
* 和RestTemplate里写的url一模一样
* @return Page
*/
// @GetMapping(value = "/reciteHis/testAno")
// Page<ReciteHisOT> memberRctHisAno();
}
package com.zengchen.user.client.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zengchen.user.common.ReciteHisOT;
import org.springframework.web.bind.annotation.GetMapping;
public interface UserCenterFeignClientService {
@GetMapping({"/reciteHis/testAno"})
Page<ReciteHisOT> memberRctHisAno();
}
feign:
sentinel:
# 开启 sentinel 支持
enabled: true
还是非继承模式好啊!
面向未来微服务:熟练掌握Spring Cloud Alibaba
了解课程