File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,10 @@ key=ip+url+args
5353
5454``` yaml 
5555spring :
56-   redis :
57-     host : 127.0.0.1 
58-     port : 6379 
56+   data :
57+     redis :
58+       host : 127.0.0.1 
59+       port : 6379 
5960` ` ` 
6061
6162理论是支持 [redisson-spring-boot-starter](https://github.com/redisson/redisson/tree/master/redisson-spring-boot-starter) 全部配置 
@@ -105,6 +106,19 @@ String info() default "重复请求,请稍后重试";
105106``` java 
106107boolean  delKey() default  false ;
107108``` 
109+ -  6 .  全局异常处理:当幂等性触发后,切面会抛出 IdempotentException 异常。需要在全局异常处理器中捕获此异常并处理,返回合适的错误信息。
110+ 
111+ ``` java 
112+ @ControllerAdvice 
113+ public  class  GlobalExceptionHandler  {
114+ 
115+     @ExceptionHandler (IdempotentException . class)
116+     public  ResponseEntity<String >  handleIdempotentException (IdempotentException  ex ) {
117+         //  处理幂等异常,返回自定义的错误信息或业务逻辑
118+         return  ResponseEntity . status(HttpStatus . BAD_REQUEST. body(ex. getMessage());
119+     }
120+ }
121+ ``` 
108122
109123#### 微信群  
110124
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments