IntelliJ IDEA验证错误的XSD

Veg*_*ard 3 java spring intellij-idea

我已经定义了以下事务管理器:

    <tx:annotation-driven transaction-manager="txManager" mode="aspectj" />
Run Code Online (Sandbox Code Playgroud)

并具有以下根元素:

<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">
Run Code Online (Sandbox Code Playgroud)

一切正常,但IntelliJ在mode ="aspectj"上给我一个错误标记, 说不允许.我已经跟随它获取xsd的位置,它链接到tx 2.0 xsd - 这解释了错误消息,因为我需要2.5来使用模式注释.

有可能以某种方式给IntelliJ一个提示,我应该向2.5而​​不是2.0验证?

mab*_*aba 8

如果schemaLocation根据此屏幕截图打开应该指向xsd 的jar文件:

在此输入图像描述

然后你会看到IntelliJ有一堆不同版本的Spring的xsd文件:

在此输入图像描述

这意味着您确实拥有所需的所有模式.

如果您的bean定义文件有问题,那么您schemaLocation必须指向Spring jar文件中的错误版本:

在此输入图像描述

检查Settings | Schemas and DTDs并确认您没有意外地手动将其设置为指向错误的xsd文件:

在此输入图像描述 在此输入图像描述

如果它是错的,那么你将不得不使用减号删除该行.这将导致IntelliJ返回其默认值:

在此输入图像描述

在那之后你应该看到与第一个屏幕截图相同的东西.