通配符的匹配很全面, 但无法找到元素 'xxxxxxxx'

时间:2023-03-09 18:41:58
通配符的匹配很全面, 但无法找到元素 'xxxxxxxx'

首先,一般配置通配符之前,你都会有如下xml头吧

<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: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/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

每当你添加了一个新的命名空间的时候(IDEA你自己手动加的话)

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

你还需要记得加入

http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

到xsi:schemaLocation=“     ”中。

据说IDEA你自己在下面用明明空间+“:”会自动帮你导入哦!!!!!(我为什么这么晚才发现,蠢哭)