您的位置:首页 > 其它

"通配符的匹配很全面, 但无法找到元素 'tx:annotation-driven' 的声明" 的解决方案

2015-10-19 10:35 281 查看
在 SpringMVC 的配置文件中,一般会出现这个错误,即通配符的匹配很全面, 但无法找到元素 XXX:XXX 。

出现这样错误的原因一般就是因为xml文件的问题。

如果在头文件中没有引入

xmlns:mvc="http://www.springframework.org/schema/mvc"


在xml中就会直接报错提示你

如果这行代码引入了,还是依旧报这个错,这就说明
xsi:schemaLocation
没有写。

如下:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd">[/code] 
上下要保证一致才不会报错。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: