weixin_44751189 2019-07-12 20:57 采纳率: 12.5%
浏览 2853

“cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'tx:advice' 的声明。”

为什么我已经加了:“ http://www.springframework.org/schema/tx“”http://www.springframework.org/schema/tx/spring-tx.xsd”
还是显示错误:“ Line 31 in XML document from class path resource [com/statement/xml/XMLstatementapplicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 31; columnNumber: 65;cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'tx:advice' 的声明。”

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframwork.org/schema/aop"
       xmlns:tx="http://www.springframwork.org/schema/tx"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx.xsd">
       <context:component-scan base-package="com.statement"/>
       <bean id="dataSource" class="org.springframework.jdbc.datasource.DriveManagerDataSource">
       <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
       <property name="url" value="jdbc:mysql://localhost:3306/springtest?characterEncoding=utf8"/>
       <property name="username" value="root"/>
       <property name="password" value="root"/>
       </bean>

       <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
       <property name="dataSource" ref="dataSource"/>
       </bean>
       <bean id="txManager" 
             class="org.springframework.jdbc.datasource.DataSourceTransaction
             Manager">
       <property name="dataSource" ref="dataSource" />
       </bean>
       <tx:advice id="myAdvice" transaction-manager="txManager">
       <tx:attributes>
       <tx:method name="*"/>
       </tx:attributes>
       </tx:advice>
       <aop:config>
       <aop:pointcut expression="execution(* com.statement.service).*.*())"
       id="txPointCut"/>
       <aop:advisor advice-ref="myAdvice" pointcut-ref="txPointCut"/>
       </aop:config>
       </beans>
  • 写回答

1条回答 默认 最新

  • 关注
    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突