我定义了以下事务管理器:
<tx:annotation-driven transaction-manager="txManager" mode="aspectj" />
并具有以下根元素:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
一切正常,但 IntelliJ 给了我一个错误标记模式=“方面”说这是不允许的。我跟踪了它从哪里获取 xsd,它链接到 tx 2.0 xsd - 这解释了错误消息,因为我需要 2.5 才能使用模式注释。
是否有可能以某种方式给 IntelliJ 一个提示,让我应该验证 2.5 而不是 2.0?
如果你打开jar文件schemaLocation
根据此屏幕截图,应指向 xsd:
然后你会看到 IntelliJ 有一堆不同版本的 Spring 的 xsd 文件:
这意味着您确实拥有所需的所有模式。
如果您的 Bean 定义文件有问题,那么您的schemaLocation
必须指向 Spring jar 文件中的错误版本:
检查Settings | Schemas and DTDs
并验证您没有意外手动将其设置为指向错误的 xsd 文件:
如果错误,则必须使用减号删除该行。这将导致 IntelliJ 返回到它的默认值:
之后,您应该看到与第一个屏幕截图中相同的内容。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)