|
|
@@ -1,6 +1,6 @@
|
|
|
package com.sckw.sentinel;
|
|
|
|
|
|
-/*
|
|
|
+
|
|
|
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler;
|
|
|
import com.alibaba.csp.sentinel.slots.block.BlockException;
|
|
|
import com.alibaba.csp.sentinel.slots.block.authority.AuthorityException;
|
|
|
@@ -16,7 +16,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
-*/
|
|
|
/**
|
|
|
* @author lfdc
|
|
|
* @version 1.0
|
|
|
@@ -24,14 +23,14 @@ import org.springframework.context.annotation.Configuration;
|
|
|
* @description 自定义sentinel异常Handler
|
|
|
* @company sckw
|
|
|
* @date 2023-06-08 09:06:59
|
|
|
- *//*
|
|
|
+ */
|
|
|
|
|
|
@Slf4j
|
|
|
@Configuration
|
|
|
public class CustomBlockExceptionHandler implements BlockExceptionHandler {
|
|
|
HttpResult httpResult = null;
|
|
|
@Override
|
|
|
- public void handle(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse, BlockException e) throws Exception {
|
|
|
+ public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, BlockException e) throws Exception {
|
|
|
log.info("urlBlock.......................");
|
|
|
//不同的异常返回不同的提示语
|
|
|
//FlowException //限流异常
|
|
|
@@ -102,4 +101,3 @@ public class CustomBlockExceptionHandler implements BlockExceptionHandler {
|
|
|
new CustomBlockExceptionHandler();
|
|
|
}
|
|
|
}
|
|
|
-*/
|