RequestMapping注解的继承问题

it2024-08-05  40

@RequestMapping注解被用来注明访问路径,例如:

@RequestMapping("/data") @RequestMapping("/user/list")

在写代码的时候遇到了there is already xxxx been method的错误,显示之前已经被注入,发现是父类中有相同的RequestMapping注解

由此可以看出RequestMapping是可以被继承的,此时需要将父类的该方法覆盖(重写该方法),就可以使当前的RequestMapping生效

下表参考自:https://www.iteye.com/blog/elf8848-1621392

 

最新回复(0)