# common-annotation **Repository Path**: vipit/common-annotation ## Basic Information - **Project Name**: common-annotation - **Description**: 🌈SpringBoot项目常用的自定义注解 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2024-07-13 - **Last Updated**: 2024-07-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # common-annotation ## 项目介绍 ​ SpringBoot项目常用的一些自定义注解,方便开发。 ## 软件架构 ​ 当前注解都是在**序列化**和**反序列化**时处理数据,所以仅依赖于`jackson-databind`(springboot默认的序列化方式) ## 注解简介 1. Cipher:字段加解密 2. Dict:字典翻译 3. DataMask:数据脱敏 ## 使用说明 ### 1.引入maven坐标 ```xml io.gitee.gltqe common-annotation 1.0.0 ``` ### 2.配置Jackson ```java /** * jackson配置类 * * @author gltqe * @date 2023/6/14 14:52 **/ @Configuration public class JacksonConfig implements JacksonCofig { @Resource CustomDataMaskHandle customDataMaskHandle; @Resource CustomCipherHandle customCipherHandle; @Resource CustomDictHandle customDictHandle; @Bean public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { return jacksonObjectMapperBuilder -> { // DataMask 可以使用默认的 DefaultDataMaskHandle List modules = getSimpleModule(customDataMaskHandle, customCipherHandle, customDictHandle); jacksonObjectMapperBuilder.modules(modules); }; } } ``` ### 3.注意 * CustomDataMaskHandle、CustomCipherHandle、CustomDictHandle 都是自己实现的,需要用到那个就实现哪个。 * DefaultDataMaskHandle 是默认的脱敏实现,如果没有特别需求可以替代CustomDataMaskHandle。 ## 版本测试 当前已测试以下springboot版本 * 3.2.1 * 3.0.0 * 2.7.18 * 2.6.0 * 2.5.0