org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping

Posted xiaohaojs

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping相关的知识,希望对你有一定的参考价值。

配置spring+shiro时,启动tomcat报错异常

严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping‘: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Z

解决办法:

web.xml拦截器异常

如下web.xml 拦截器代码

  1 <servlet>
  2         <servlet-name>DispatcherServlet</servlet-name>
  3         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  4         <init-param>
  5             <param-name>contextConfigLocation</param-name>
  6             <param-value>classpath:spring/springmvc.xml</param-value>
  7         </init-param>
  8         <load-on-startup>1</load-on-startup>
  9         <async-supported>true</async-supported>
 10     </servlet>
 11     <servlet-mapping>
 12         <servlet-name>DispatcherServlet</servlet-name>
 13         <url-pattern>/</url-pattern>
 14     </servlet-mapping>
 15 

查找后得知:web.xml版本号为2.3 修改版本号为3.0即可

以上是关于org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping的主要内容,如果未能解决你的问题,请参考以下文章