From abcad73380287ac2f2e6bb473b70b07b5486d7fa Mon Sep 17 00:00:00 2001 From: raywang Date: Sun, 22 May 2016 23:47:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2=E6=89=BE?= =?UTF-8?q?=E4=B8=8D=E5=88=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/seckill/service/impl/SeckillServiceImpl.java | 3 ++- src/main/resources/spring/spring-web.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/seckill/service/impl/SeckillServiceImpl.java b/src/main/java/org/seckill/service/impl/SeckillServiceImpl.java index 848b187..c681916 100644 --- a/src/main/java/org/seckill/service/impl/SeckillServiceImpl.java +++ b/src/main/java/org/seckill/service/impl/SeckillServiceImpl.java @@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.test.annotation.Rollback; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.DigestUtils; @@ -69,13 +70,13 @@ public Exposer exportSeckillUrl(long seckillId) { } - @Transactional /** * 使用注解控制事务的优点: * 1.开发团队达成一致约定,明确标注事务方法的编程风格. * 2.保证事务方法的执行时间尽可能短,不要穿插其他网络操作RPC/HTTP请求或者玻璃到事务方法外部. * 3.不是所有的方法都需要事务.如一些查询的service.只有一条修改操作的service. */ + @Transactional public SeckillExecution executeSeckill(long seckillId, long userPhone, String md5) throws SeckillException, RepeatKillException, SeckillCloseException { if (StringUtils.isEmpty(md5) || !md5.equals(getMD5(seckillId))) { throw new SeckillException("seckill data rewrite"); diff --git a/src/main/resources/spring/spring-web.xml b/src/main/resources/spring/spring-web.xml index f561dbc..c61708a 100644 --- a/src/main/resources/spring/spring-web.xml +++ b/src/main/resources/spring/spring-web.xml @@ -22,7 +22,7 @@ - +