赞
踩
自我记录,有用得到的拿去用,有问题私信我
- @Target({ElementType.METHOD})
- @Retention(RetentionPolicy.RUNTIME)
- @Documented
- public @interface NoRepeatSubmit {
-
- /**
- * 默认1s钟以内算重复提交
- * @return
- */
- long timeout() default 1;
-
- }
- @Aspect
- @Component
- public class NoRepeatSubmitAop {
- @Resource
- private RedisUtils redisUtils;
- /**
- * 定义切入点
- */
- @Pointcut("@annotation(app.annotation.NoRepeatSubmit)")
- public void noRepeat() {}
-
- /**
- * 前置通知:在连接点之前执行的通知
- * @param point
- * @throws Throwable
- */
- @Before("noRepeat()")
- public void before(JoinPoint point) throws Exception{
- ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
- HttpServ

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。