resources/application-service.xml

(完整代码) 2KB

<?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:context="http://www.springframework.org/schema/context"
	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/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.sxt.sys.service.impl"></context:component-scan>
	<context:component-scan base-package="com.sxt.bus.service.impl"></context:component-scan>
	<context:component-scan base-package="com.sxt.stat.service.impl"></context:component-scan>
	
	<!-- 1,声明事务管理器 -->
	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		 <property name="dataSource" ref="dataSource"></property>
	</bean>	
	<!-- 启动注解事务 -->
	<!-- <tx:annotation-driven/> -->
	<!-- 2,声明事务的传播特性 也就是通知 -->
	<tx:advice id="advise" transaction-manager="transactionManager">
		<tx:attributes>
			<!-- 以add开头的方法名需要事务 -->
			<tx:method name="add*" propagation="REQUIRED"/>
			<tx:method name="save*" propagation="REQUIRED"/>
			<tx:method name="update*" propagation="REQUIRED"/>		
			<tx:method name="delete*" propagation="REQUIRED"/>		
			<tx:method name="change*" propagation="REQUIRED"/>		
			<tx:method name="reset*" propagation="REQUIRED"/>	
			<tx:method name="get*" read-only="true"/>
			<tx:method name="load*" read-only="true"/>
			<tx:method name="*" read-only="true"/>	
		</tx:attributes>
	</tx:advice>
	<!-- 3进行AOP织入 -->
	<aop:config>
		<!-- 声明切面 -->
		<aop:pointcut expression="execution(* com.sxt.sys.service.impl.*.*(..))" id="pc1"/>
		<aop:pointcut expression="execution(* com.sxt.bus.service.impl.*.*(..))" id="pc2"/>
		<aop:pointcut expression="execution(* com.sxt.stat.service.impl.*.*(..))" id="pc3"/>
		<!-- 织入 -->
		<aop:advisor advice-ref="advise" pointcut-ref="pc1"/>
		<aop:advisor advice-ref="advise" pointcut-ref="pc2"/>
		<aop:advisor advice-ref="advise" pointcut-ref="pc3"/>
	</aop:config>
</beans>

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。