This commit is contained in:
白茶清欢 2025-06-06 21:16:31 +08:00
parent 8970a6e352
commit ff2e558a0c
9 changed files with 10 additions and 12 deletions

View File

@ -3,7 +3,7 @@
在主入口函数增加如下注解: 在主入口函数增加如下注解:
```bash ```bash
@Import(value = { cn.zhangdeman.HashMapCache.class}) // 让SpringBoot能够扫描到相关组件 @Import(value = { cn.zhangdeman.exception.HashMapCache.class}) // 让SpringBoot能够扫描到相关组件
``` ```
会自动扫描自定义的异常注解, 并进行数据初始化 会自动扫描自定义的异常注解, 并进行数据初始化

View File

@ -1,9 +1,7 @@
package cn.zhangdeman; package cn.zhangdeman.exception;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.Objects;
// 自定义异常 // 自定义异常
@Getter @Getter

View File

@ -1,4 +1,4 @@
package cn.zhangdeman; package cn.zhangdeman.exception;
// 获取一个异常定义 // 获取一个异常定义
public class CustomExceptionConfig implements ICustomExceptionConfig{ public class CustomExceptionConfig implements ICustomExceptionConfig{

View File

@ -1,6 +1,6 @@
package cn.zhangdeman; package cn.zhangdeman.exception;
import cn.zhangdeman.annotation.CustomExceptionScanAnnotation; import cn.zhangdeman.exception.annotation.CustomExceptionScanAnnotation;
import jakarta.servlet.ServletContextEvent; import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener; import jakarta.servlet.ServletContextListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package cn.zhangdeman; package cn.zhangdeman.exception;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package cn.zhangdeman; package cn.zhangdeman.exception;
// 异常的配置: 所属服务 + 错误分类 + 错误码全局唯一, 所属服务未配置, 将会随机生成 // 异常的配置: 所属服务 + 错误分类 + 错误码全局唯一, 所属服务未配置, 将会随机生成
public interface ICustomExceptionConfig { public interface ICustomExceptionConfig {

View File

@ -1,4 +1,4 @@
package cn.zhangdeman.annotation; package cn.zhangdeman.exception.annotation;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,4 @@
package cn.zhangdeman.annotation; package cn.zhangdeman.exception.annotation;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,4 +1,4 @@
package cn.zhangdeman.annotation; package cn.zhangdeman.exception.annotation;
import java.lang.annotation.*; import java.lang.annotation.*;