Spring MVC加载上下文时无法识别RequestMapping批注名称属性

【字号: 日期:2024-03-25浏览:50作者:雯心
(adsbygoogle = window.adsbygoogle || []).push({}); 如何解决Spring MVC加载上下文时无法识别RequestMapping批注名称属性?

似乎是类路径问题。正在加载旧版本的RequestMapping。

解决方法

我有一个带有@Controller注解的Spring的应用程序@RequestMapping。使用Spring(核心和webmvc)4.1.0.RELEASE或更高版本启动应用程序服务器时出现异常。

java.lang.NoSuchMethodError: org.springframework.web.bind.annotation.RequestMapping.name()Ljava/lang/String;at method RequestMappingHandlerMapping.createRequestMappingInfo(RequestMapping annotation,RequestCondition<?> customCondition)

使用Eclipseinspect进行调试,方法变量annotation不包含name属性,并且操作失败annotation.name()。所有其他属性值都是正确的(它们在Controller方法中定义的值带有注释@RequestMapping)。

我正在使用Tomcat 7和Maven 2.3。 mvndependency:tree除了4.1.0.RELEASE以外,没有显示其他Spring版本。使用Spring4.0.7.RELEASE或更低版本不会发生此错误。有人有任何线索吗?

相关文章: