与元素类型 "beans" 关联的属性 "xsi:schemaLocation" 的前缀 "xsi" 未绑定
The prefix "xsi" for attribute "xsi:schemaLocation" associated with an element type "beans" is not bound
为什么我会遇到这个错误
[Fatal Error]: The prefix "xsi" for attribute "xsi:schemaLocation" associated with an element type "beans" is not bound.
在我的 XML 文件的 header:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
错误出现在我的 XML 声明的最后一行。
请问我该怎么做才能消除这个错误?
只需添加
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
到您的 bean
元素以消除该错误。
为什么我会遇到这个错误
[Fatal Error]: The prefix "xsi" for attribute "xsi:schemaLocation" associated with an element type "beans" is not bound.
在我的 XML 文件的 header:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
错误出现在我的 XML 声明的最后一行。 请问我该怎么做才能消除这个错误?
只需添加
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
到您的 bean
元素以消除该错误。