iDEA Lombok 失效 和 slf log 变量失效问题
1. lombok 失效:
检查下配置有没有使用注解处理器;且这个处理中有没有带上版本;版本号需要与上面引入的依赖版本一致。
2. 对于找不到 log 变量的操作,则是使用下面将这个变量使用下面的代码定义出来;上面去掉 slf4j注解
@Hidden
@RestControllerAdvice
public class GlobalExceptionHandler {private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(GlobalExceptionHandler.class);@ExceptionHandler(BusinessException.class)public BaseResponse<?> businessExceptionHandler(BusinessException e) {log.error("BusinessException", e);return ResultUtils.error(e.getCode(), e.getMessage());}@ExceptionHandler(RuntimeException.class)public BaseResponse<?> runtimeExceptionHandler(RuntimeException e) {log.error("RuntimeException", e);return ResultUtils.error(ErrorCode.SYSTEM_ERROR, "系统错误");}
}