SpringMVC配置文件报错

       在配置注解处理器映射器、处理器适配器时,已引入   xmlns:mvc="http://www.springframework.org/schema/mvc"和

http://www.springframework.org/schema/mvc    http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd

后,在写<mvc:annotation-driven/>时,报The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven'.错误可以在xsi:schemaLocation中添加tx支持,即添加如下代码:

xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd

http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-4.0.xsd" >

问题就解决啦!

猜你喜欢

转载自blog.csdn.net/lxc_1206/article/details/79999917