配置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即可
原文地址:https://www.cnblogs.com/xiaohaojs/p/10828058.html
时间: 2024-10-25 13:30:06