Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://
www.springframework.org/schema/tx/spring-tx.xsd', because 1) could not find the document;
2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be
found for element '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.springframework.org/schema/aop"
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/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">
<!-- 配置資料源 -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="https://bbs.csdn.net/topics/com.mysql.jdbc.Driver"/>
<property name="url" value="https://bbs.csdn.net/topics/jdbc:mysql://localhost:3306/test"/>
<property name="username" value="https://bbs.csdn.net/topics/root"/>
<property name="password" value="https://bbs.csdn.net/topics/1012"/>
</bean>
<!-- 宣告式事務配置開始 -->
<!-- 配置事務管理器 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 配置事務通知 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<!-- 配置哪些方法使用宣告樣的事務,配置事務的傳播特性 -->
<tx:method name="add" propagation="REQUIRED"/>
<tx:method name="insert" propagation="REQUIRED"/>
<tx:method name="update" propagation="REQUIRED"/>
<tx:method name="remove*" propagation="REQUIRED"/>
<tx:method name="add" propagation="REQUIRED"/>
<tx:method name="get" read-only="true"/>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* cn.sxt.dao.impl.*.*(..))" id="pointcut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut"/>
</aop:config>
<!-- 宣告式事務配置結束 -->
<!-- 配置sqlSessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations" value="https://bbs.csdn.net/topics/classpath:cn/sxt/vo/*.mapper.xml"></property>
</bean>
<import resource="cofig/spring/user.xml"/>
</beans>
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/117415.html
標籤:Java相關
上一篇:冒險島愛好者的求助
下一篇:請問這個連接資料庫的錯誤怎么改
