<tx:advice id="txAdvice2" transaction-manager="txManager">
<tx:attributes>
<tx:method name="inserttwo*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* com.test.*.*(..))" id="pointCu"/>
<!-- <aop:pointcut expression="execution(* ssm.service.*.*(..))" id="pointCut"/> -->
<aop:advisor advice-ref="txAdvice2" pointcut-ref="pointCu"/>
</aop:config>
@Test
public void inserttwo(){
UserInfo user=new UserInfo();
user.setEmail("email");
user.setPassword("password");
user.setUsername("d9805943");
userService.insert(user);
int i=10/10;
我这样配调用inserttwo()方法后还是会插入这个userinfo
第一:web层事务,这一般是针对那些安全性要求较高的系统来说的。例如电子商务网站。粒度小,一般系统用不着这么细。
第二:service层事务,这是一常见的事务划分, 将事务设置在业务逻辑上,只要业务逻辑出错或异常就事务回滚。粒度较小,一般推荐这种方式。
第三:数据持久层数据务,也就是常说的数据库事务。这种事务在安全性方面要求低。就是给一个简单的增删改之类的操作增加事务操作。粒度大
有问题吗,插入了数据说明事物提交啦。你程序又没有异常。
应该是10除0的我改了还是会提交数据到数据库的
你用JUNIT来执行?junit执行的话,spring根本没有启动吧?