由于我们的服务器资源有限,需要对请求进行限制
过程:获得请求后,放入set锁的方法进行判断,不是重复提交的请求则获得执行进程的能力,并设置对应当前请求锁的过期时间,如果在过期时间前的再次请求则视为重复请求,不执行进程
@Around(value = "pointCut(avoidRepeatSubmit)", argNames = "pjp,avoidRepeatSubmit")
public Object around(ProceedingJoinPoint pjp, AvoidRepeatSubmit avoidRepeatSubmit) throws Throwable {
ResultUtils ResultUtils1=new ResultUtils();
long lockMillSeconds = avoidRepeatSubmit.lockTime();
HttpServletRequest request = httpServletRequest();
Assert.notNull

本文介绍了如何在Spring Boot应用中防止接口收到大量重复请求,通过使用Set锁进行请求判断,确保非重复请求可以执行,并设置请求锁的过期时间,以此限制资源消耗。

650

被折叠的 条评论
为什么被折叠?



