Compare commits
4 Commits
cae49c33c8
...
217559609e
| Author | SHA1 | Date |
|---|---|---|
|
|
217559609e | |
|
|
a6bcebb62b | |
|
|
1cb262daa3 | |
|
|
e44d400366 |
|
|
@ -29,7 +29,7 @@ http {
|
|||
}
|
||||
|
||||
# 避免actuator暴露
|
||||
if ($request_uri ~ "/actuator") {
|
||||
if ($uri ~ "/actuator") {
|
||||
return 403;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.common.security.handler;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* @description 高优先级的异常处理
|
||||
* @author Acechengui
|
||||
* @date Created in 2023-08-29
|
||||
*/
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@RestControllerAdvice
|
||||
public class HighestGlobalExceptionHandler {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(HighestGlobalExceptionHandler.class);
|
||||
|
||||
@ExceptionHandler(SQLException.class)
|
||||
public AjaxResult handleSQLException(SQLException e, HttpServletRequest request) {
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',发生脚本执行异常.", requestURI, e);
|
||||
return AjaxResult.error("发生了数据库异常");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue