Fork me on Github
欢迎来到zhang-shuai的博客
zhangshuai
晓看天色暮看云,行也思君,坐也思君

springcloud问题

一、不能注入问题

问题:模块引用外模块注入问题

 

 解决:

1.在主类添加组件扫描@ComponentScan(basePackages = "com.atguigu"),@EnableFeignClients

2.在接口类添加@FeignClient("service-edu"),@Component

3.引用方法的请求方法路由要写全路径

二、404错误

问题:

 

 

 解决:在接口中PathVariable中要有值

1.@GetMapping("/eduorder/order/isBuyCourse/{courseId}/{memberId}")
public boolean isBuyCourse(@PathVariable(value = "courseId") String courseId,@PathVariable(value = "memberId") String memberId);
2.在springcloud 的配置文件中,加上了这个 server.servlet.context-path,加上 此路径 即可,或者去掉 server.servlet.context-path

3.@FeignClient(value = "service-order",fallback = OrderFile.class)

posted @ 2021-07-23 09:17  咘網鶵釁  阅读(47)  评论(0编辑  收藏  举报