@RequestMapping annotation not allowed on @FeignClient interfaces
来源:2-14 【技术改造】电商系统用户模块集成Feign-1
网信科技
2022-06-01 17:49:40
service模块,@RequestMapping 与 @FeignClient 一起使用是报错
相关代码:
@FeignClient("foodie-item-service") @RequestMapping("item-comments-api") public interface ItemCommentsService { .... } // 启动报错 Unexpected exception during bean creation; nested exception is java.lang.IllegalArgumentException: @RequestMapping annotation not allowed on @FeignClient interfaces
我在网上搜索了一下,他们说两个注解不能一起使用。会不会和springboot版本有关?我的环境 springboot 2.6.8 springcloud 2021.0.2
1回答
同学说的没错,所以在新版本里面,我们就把requestmapping里的路径参数放到GetMapping/PostMapping这类方法注解上就可以了
相似问题