spring事务启动报错(eclipse,jdk1.8,spring4.3.6)
Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element
'tx:advice'.
一开始我的命名空间是下方蓝色字体的,没有加tx之前是没有发现任何问题,直到我使用tx便签时报了上面红字错误
为此我百度了很久,大佬都说是schemaLocation里面没有添加
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
但很明显我是有添加的,而后我改用了紫色字体的命名空间,也就是把所有版本号都去除了,就不报错了
虽然解决了,但是不知道是什么原因,有大佬知道的话谢谢留言
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/shcema/aop"
xmlns:tx="http://www.springframework.org/shcema/tx"
xmlns:context="http://www.springframework.org/shcema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/shcema/context
http://www.springframework.org/shcema/context/spring-context-4.3.xsd
http://www.springframework.org/shcema/aop
http://www.springframework.org/shcema/aop/spring-aop-4.3.xsd"
>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
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.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
本文详细探讨了在Eclipse环境下,使用JDK1.8和Spring4.3.6进行事务管理时遇到的配置错误。作者最初在XML配置文件中添加了Spring的事务管理命名空间和对应的xsd文件路径,但在使用tx:advice标签时遇到了问题。通过对比两种不同的命名空间配置方式,最终发现移除版本号可以避免错误,但具体原因仍待探讨。

313

被折叠的 条评论
为什么被折叠?



