在idea中运行spring的项目报如下错误
nested exception is org.xml.sax.SAXParseException; lineNumber: 41; columnNumber: 71; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'tx:advice' 的声明。
应该是头部文件未引全,未解决之前,头部文件是这样的:
虽然在xmlns中有tx的引入,但是在schemaLocation中没有引入tx的schema
所以应该在schemaLocation中加入tx的schema
需要在后面加上:
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
变为以下的头部文件:
以上问题就会解决