SpringBoot或OpenFeign中 Jackson 配置参数名蛇形、小驼峰、大驼峰、自定义命名

SpringBoot或OpenFeign中 Jackson 配置参数名蛇形、小驼峰、大驼峰、自定义命名

前言

在调用外部接口时,对方给出的接口文档中,入参参数名一会大写加下划线,一会又是驼峰命名。
示例如下:

{"MOF_DIV_CODE": "xxxxx",....."yyyList": ["VOU_DET_ID": "xxxxx",......]
}

至于为什么非要这样写,不去深究它。背后默默 diss 一下。
当我利用OpenFeign调用接口时,传入参数定义的DTO对象都是大写的,如下:

public class XxxReqDTO {private String MOF_DIV_CODE;....private String XXX_XXX_XXX;....private List<YyyReqDTO> yyyList;
}
/**
*  这里没有使用@Data注解
*  用IDEA生成的setter()、getter()方法
*  如果@Data 生成的出现问题,可以改成自己生成。
**/

也配置了MyBatis-Plus不自动转驼峰命名

mybatis-plus:configuration:map-underscore-to-camel-case: false

但是控制台打印入参时,却变成了小写、下划线、大写,示例如下:

{mOF_DIV_CODE : "xxxxx"......yyyList:["vOU_DET_ID": "xxxxx",]
}

因为之前遇到过类似的问题,想到时SpringBoot Jackson序列化、反序列化及配置问题。
以下记录我的解决方法与过程。

解决办法

数据库字段重命名

这里以PostgreSQL为例(本次开发使用指定数据库),其他数据库自测下。本方法为偷懒做法,多的时间用于摸鱼

select
pk_detail  "VOU_ID"
from table;

在这里插入图片描述
在查询时,直接重命名字段,记住一定要加引号,不然数据库里查询结果列名字段也会是小写。
不加引号效果如下:
在这里插入图片描述
这样使得让查询的结果与定义入参对象都是大写+下划线的参数名。

配置Jackson

特地去看了下 PropertyNamingStrategy 的源码,没找到我想要的命名方式。
源码如下:

package com.fasterxml.jackson.databind;import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.introspect.AnnotatedField;
import com.fasterxml.jackson.databind.introspect.AnnotatedMethod;
import com.fasterxml.jackson.databind.introspect.AnnotatedParameter;/*** Class that defines how names of JSON properties ("external names")* are derived from names of POJO methods and fields ("internal names"),* in cases where no explicit annotations exist for naming.* Methods are passed information about POJO member for which name is needed,* as well as default name that would be used if no custom strategy was used.*<p>* Default (empty) implementation returns suggested ("implicit" or "default") name unmodified*<p>* Note that the strategy is guaranteed to be called once per logical property* (which may be represented by multiple members; such as pair of a getter and* a setter), but may be called for each: implementations should not count on* exact number of times, and should work for any member that represent a* property.* Also note that calls are made during construction of serializers and deserializers* which are typically cached, and not for every time serializer or deserializer* is called.*<p>* In absence of a registered custom strategy, the default Java property naming strategy* is used, which leaves field names as is, and removes set/get/is prefix* from methods (as well as lower-cases initial sequence of capitalized* characters).*<p>* NOTE! Since 2.12 sub-classes defined here (as well as static singleton instances thereof)* are deprecated due to* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>.* Please use constants and classes in {@link PropertyNamingStrategies} instead.* */
@SuppressWarnings("serial")
public class PropertyNamingStrategy // NOTE: was abstract until 2.7implements java.io.Serializable
{private static final long serialVersionUID = 2L;/*** @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#LOWER_CAMEL_CASE} instead.* See* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reasons for deprecation.*/@Deprecated // since 2.12public static final PropertyNamingStrategy LOWER_CAMEL_CASE = new PropertyNamingStrategy();/*** @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#UPPER_CAMEL_CASE} instead.* See* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reasons for deprecation.*/@Deprecated // since 2.12public static final PropertyNamingStrategy UPPER_CAMEL_CASE = new UpperCamelCaseStrategy();/*** @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#SNAKE_CASE} instead.* See* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reasons for deprecation.*/@Deprecated // since 2.12public static final PropertyNamingStrategy SNAKE_CASE = new SnakeCaseStrategy();/*** @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#LOWER_CASE} instead.* See* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reasons for deprecation.*/@Deprecated // since 2.12public static final PropertyNamingStrategy LOWER_CASE = new LowerCaseStrategy();/*** @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#KEBAB_CASE} instead.* See* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reasons for deprecation.*/@Deprecated // since 2.12public static final PropertyNamingStrategy KEBAB_CASE = new KebabCaseStrategy();/*** @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#LOWER_DOT_CASE} instead.* See* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reasons for deprecation.*/@Deprecated // since 2.12public static final PropertyNamingStrategy LOWER_DOT_CASE = new LowerDotCaseStrategy();/*/**********************************************************/* API/***********************************************************//*** Method called to find external name (name used in JSON) for given logical* POJO property,* as defined by given field.* * @param config Configuration in used: either <code>SerializationConfig</code>*   or <code>DeserializationConfig</code>, depending on whether method is called*   during serialization or deserialization* @param field Field used to access property* @param defaultName Default name that would be used for property in absence of custom strategy* * @return Logical name to use for property that the field represents*/public String nameForField(MapperConfig<?> config, AnnotatedField field,String defaultName){return defaultName;}/*** Method called to find external name (name used in JSON) for given logical* POJO property,* as defined by given getter method; typically called when building a serializer.* (but not always -- when using "getter-as-setter", may be called during* deserialization)* * @param config Configuration in used: either <code>SerializationConfig</code>*   or <code>DeserializationConfig</code>, depending on whether method is called*   during serialization or deserialization* @param method Method used to access property.* @param defaultName Default name that would be used for property in absence of custom strategy* * @return Logical name to use for property that the method represents*/public String nameForGetterMethod(MapperConfig<?> config, AnnotatedMethod method,String defaultName){return defaultName;}/*** Method called to find external name (name used in JSON) for given logical* POJO property,* as defined by given setter method; typically called when building a deserializer* (but not necessarily only then).* * @param config Configuration in used: either <code>SerializationConfig</code>*   or <code>DeserializationConfig</code>, depending on whether method is called*   during serialization or deserialization* @param method Method used to access property.* @param defaultName Default name that would be used for property in absence of custom strategy* * @return Logical name to use for property that the method represents*/public String nameForSetterMethod(MapperConfig<?> config, AnnotatedMethod method,String defaultName){return defaultName;}/*** Method called to find external name (name used in JSON) for given logical* POJO property,* as defined by given constructor parameter; typically called when building a deserializer* (but not necessarily only then).* * @param config Configuration in used: either <code>SerializationConfig</code>*   or <code>DeserializationConfig</code>, depending on whether method is called*   during serialization or deserialization* @param ctorParam Constructor parameter used to pass property.* @param defaultName Default name that would be used for property in absence of custom strategy*/public String nameForConstructorParameter(MapperConfig<?> config, AnnotatedParameter ctorParam,String defaultName){return defaultName;}/*/**********************************************************/* Public base class for simple implementations/***********************************************************//*** @deprecated Since 2.12 deprecated. See* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reasons for deprecation.*/@Deprecatedpublic static abstract class PropertyNamingStrategyBase extends PropertyNamingStrategy{@Overridepublic String nameForField(MapperConfig<?> config, AnnotatedField field, String defaultName){return translate(defaultName);}@Overridepublic String nameForGetterMethod(MapperConfig<?> config, AnnotatedMethod method, String defaultName){return translate(defaultName);}@Overridepublic String nameForSetterMethod(MapperConfig<?> config, AnnotatedMethod method, String defaultName){return translate(defaultName);}@Overridepublic String nameForConstructorParameter(MapperConfig<?> config, AnnotatedParameter ctorParam,String defaultName){return translate(defaultName);}public abstract String translate(String propertyName);/*** Helper method to share implementation between snake and dotted case.*/protected static String translateLowerCaseWithSeparator(final String input, final char separator){if (input == null) {return input; // garbage in, garbage out}final int length = input.length();if (length == 0) {return input;}final StringBuilder result = new StringBuilder(length + (length >> 1));int upperCount = 0;for (int i = 0; i < length; ++i) {char ch = input.charAt(i);char lc = Character.toLowerCase(ch);if (lc == ch) { // lower-case letter means we can get new word// but need to check for multi-letter upper-case (acronym), where assumption// is that the last upper-case char is start of a new wordif (upperCount > 1) {// so insert hyphen before the last character nowresult.insert(result.length() - 1, separator);}upperCount = 0;} else {// Otherwise starts new word, unless beginning of stringif ((upperCount == 0) && (i > 0)) {result.append(separator);}++upperCount;}result.append(lc);}return result.toString();}}/*/**********************************************************/* Standard implementations /***********************************************************//*** @deprecated Since 2.12 use {@link PropertyNamingStrategies.SnakeCaseStrategy} instead* (see* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reason for deprecation)*/@Deprecated // since 2.12public static class SnakeCaseStrategy extends PropertyNamingStrategyBase{@Overridepublic String translate(String input){if (input == null) return input; // garbage in, garbage outint length = input.length();StringBuilder result = new StringBuilder(length * 2);int resultLength = 0;boolean wasPrevTranslated = false;for (int i = 0; i < length; i++){char c = input.charAt(i);if (i > 0 || c != '_') // skip first starting underscore{if (Character.isUpperCase(c)){if (!wasPrevTranslated && resultLength > 0 && result.charAt(resultLength - 1) != '_'){result.append('_');resultLength++;}c = Character.toLowerCase(c);wasPrevTranslated = true;}else{wasPrevTranslated = false;}result.append(c);resultLength++;}}return resultLength > 0 ? result.toString() : input;}}/*** @deprecated Since 2.12 use {@link PropertyNamingStrategies.UpperCamelCaseStrategy} instead* (see* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reason for deprecation)*/@Deprecated // since 2.12public static class UpperCamelCaseStrategy extends PropertyNamingStrategyBase{/*** Converts camelCase to PascalCase* * For example, "userName" would be converted to* "UserName".** @param input formatted as camelCase string* @return input converted to PascalCase format*/@Overridepublic String translate(String input) {if (input == null || input.isEmpty()){return input; // garbage in, garbage out}// Replace first lower-case letter with upper-case equivalentchar c = input.charAt(0);char uc = Character.toUpperCase(c);if (c == uc) {return input;}StringBuilder sb = new StringBuilder(input);sb.setCharAt(0, uc);return sb.toString();}}/*** @deprecated Since 2.12 use {@link PropertyNamingStrategies.LowerCaseStrategy} instead* (see* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reason for deprecation)*/@Deprecated // since 2.12public static class LowerCaseStrategy extends PropertyNamingStrategyBase{@Overridepublic String translate(String input) {return input.toLowerCase();}}/*** @deprecated Since 2.12 use {@link PropertyNamingStrategies.KebabCaseStrategy} instead* (see* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reason for deprecation)*/@Deprecated // since 2.12public static class KebabCaseStrategy extends PropertyNamingStrategyBase{@Overridepublic String translate(String input) {return translateLowerCaseWithSeparator(input, '-');}}/*** @deprecated Since 2.12 use {@link PropertyNamingStrategies.LowerDotCaseStrategy} instead* (see* <a href="https://github.com/FasterXML/jackson-databind/issues/2715">databind#2715</a>* for reason for deprecation)*/@Deprecated // since 2.12public static class LowerDotCaseStrategy extends PropertyNamingStrategyBase {@Overridepublic String translate(String input){return translateLowerCaseWithSeparator(input, '.');}}/*/**********************************************************/* Deprecated variants, aliases/***********************************************************//*** @deprecated Since 2.7 use {@link PropertyNamingStrategies#SNAKE_CASE} instead.*/@Deprecated // since 2.7public static final PropertyNamingStrategy CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES = SNAKE_CASE;/*** @deprecated Since 2.7 use {@link PropertyNamingStrategies#UPPER_CAMEL_CASE} instead;*/@Deprecated // since 2.7public static final PropertyNamingStrategy PASCAL_CASE_TO_CAMEL_CASE = UPPER_CAMEL_CASE;/*** @deprecated In 2.7 use {@link PropertyNamingStrategies.SnakeCaseStrategy} instead*/@Deprecated // since 2.7public static class LowerCaseWithUnderscoresStrategy extends SnakeCaseStrategy {}/*** @deprecated In 2.7 use {@link PropertyNamingStrategies.UpperCamelCaseStrategy} instead*/@Deprecated // since 2.7public static class PascalCaseStrategy extends UpperCamelCaseStrategy { }
}

命名方式说明:

LOWER_CAMEL_CASE(小驼峰命名法)例如:userName、userName
UPPER_CAMEL_CASE(大驼峰命名法) 例如:ServiceDiscovery、LruCacheFactory
SNAKE_CASE(蛇形命名法,就是常用的小写字母加下划线命名法)例如: user_name
LOWER_CASE (小写命名法,字母均小写,单词之间通常用下划线(_)连接)例如:first_name
KEBAB_CASE (采用小写字母和短横线(-)连接单词,形似烤肉串)例如:user-profile
LOWER_DOT_CASE (所有字母均为小写,并用点(.)连接字符的命名方式) 例如:lower.case
// SNAKE_CASE 和 LOWER_CASE 似乎一样,不知道理解没,自行百度一下。 

以上都不是我想要,那就自定义。

自定义命名方式

UpperSnakeCaseStrategy.java


import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.introspect.AnnotatedField;
import com.fasterxml.jackson.databind.introspect.AnnotatedMethod;/*** 配置字段名全大写和下划线分隔(SCREAMING_SNAKE_CASE 大写蛇形命名法)*/
public class UpperSnakeCaseStrategy extends PropertyNamingStrategy {@Overridepublic String nameForField(MapperConfig<?> config, AnnotatedField field, String defaultName) {return toUpperSnakeCase(defaultName);}@Overridepublic String nameForGetterMethod(MapperConfig<?> config, AnnotatedMethod method, String defaultName) {return toUpperSnakeCase(defaultName);}@Overridepublic String nameForSetterMethod(MapperConfig<?> config, AnnotatedMethod method, String defaultName) {return toUpperSnakeCase(defaultName);}private String toUpperSnakeCase(String input) {if (input == null) return null;return input.replaceAll("([a-z0-9])([A-Z])", "$1_$2").toUpperCase();}
}

全局配置Jackson


import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class JacksonConfig {@Beanpublic ObjectMapper objectMapper() {ObjectMapper mapper = new ObjectMapper();// 配置大写蛇形命名法mapper.setPropertyNamingStrategy(new UpperSnakeCaseStrategy());return mapper;}
}

单个类配置

@JsonNaming(UpperSnakeCaseStrategy.class)
public class Xxx{}

针对这一个小驼峰命名,特殊处理

    @JsonProperty("yyylList")private List<YyyReqDTO> yyyList;

对需要保留驼峰命名的字段单独使用@JsonProperty注解
针对蛇形命名、小驼峰、大驼峰等正常的命名字段单独使用@JsonProperty注解去实现。
例如:

@JsonProperty("yyy_list")
@JsonProperty("yyyList")
@JsonProperty("YyyList")

蛇形+首字母大写

自测自测,应该也是能行的。
Jackson 提供了UPPER_CAMEL_CASE策略,但需要结合SNAKE_CASE进行额外配置

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class JacksonConfig {@Beanpublic ObjectMapper objectMapper() {ObjectMapper mapper = new ObjectMapper();// 配置大写蛇形命名法mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE.withUpperCaseFirstLetter(true) // 首字母大写return mapper;// 注意:这种方式生成的是 "My_Field_Name",如果需要全大写还需自定义}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/news/914373.shtml
繁体地址,请注明出处:http://hk.pswp.cn/news/914373.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

uni-app 途径站点组件开发与实现分享

在移动应用开发中&#xff0c;涉及到出行、物流等场景时&#xff0c;途径站点的展示是一个常见的需求。本文将为大家分享一个基于 uni-app 开发的途径站点组件&#xff0c;该组件能够清晰展示路线中的各个站点信息&#xff0c;包括站点名称、到达时间、是否已到达等状态&#x…

kotlin中集合的用法

从一个实际应用看起以下kotlin中代码语法正确吗 var testBeanAIP0200()var testList:List<AIP0200> ArrayList()testList.add(testBean)这段Kotlin代码存在语法错误&#xff0c;主要问题在于&#xff1a;List<AIP0200> 是Kotlin中的不可变集合接口&#xff0c;不能…

深入理解 Java Map 与 Set

文章目录前言1. 搜索树1.1 什么是搜索树1.2 查找1.3 插入1.4 删除情况一&#xff1a;cur 没有子节点&#xff08;即为叶子节点&#xff09;情况二&#xff1a;cur 只有一个子节点&#xff08;只有左子树或右子树&#xff09;情况三&#xff1a;cur 有两个子节点&#xff08;左右…

excel如何只保留前几行

方法一&#xff1a;手动删除多余行 选中你想保留的最后一行的下一行&#xff08;比如你只保留前10行&#xff0c;那选第11行&#xff09;。按住 Shift Ctrl ↓&#xff08;Windows&#xff09;或 Shift Command ↓&#xff08;Mac&#xff09;&#xff0c;选中从第11行到最…

实时连接,精准监控:风丘科技数据远程显示方案提升试验车队管理效率

风丘科技推出的数据远程实时显示方案更好地满足了客户对于试验车队远程实时监控的需求&#xff0c;并真正实现了试验车队的远程管理。随着新的数据记录仪软件IPEmotion RT和相应的跨平台显示解决方案的引入&#xff0c;让我们的客户端不仅可在线访问记录器系统状态&#xff0c;…

灰盒级SOA测试工具Parasoft SOAtest重新定义端到端测试

还在为脆弱的测试环境、强外部依赖和低效的测试复用拖慢交付而头疼&#xff1f;尤其在银行、医疗、制造等关键领域&#xff0c;传统的端到端测试常因环境不稳、接口难模拟、用例难共享而举步维艰。 灰盒级SOA测试工具Parasoft SOAtest以可视化编排简化复杂测试流程&#xff0c…

OKHttp 核心知识点详解

OKHttp 核心知识点详解 一、基本概念与架构 1. OKHttp 简介 类型&#xff1a;高效的HTTP客户端特点&#xff1a; 支持HTTP/2和SPDY&#xff08;多路复用&#xff09;连接池减少请求延迟透明的GZIP压缩响应缓存自动恢复网络故障2. 核心组件组件功能OkHttpClient客户端入口&#…

从“被动巡检”到“主动预警”:塔能物联运维平台重构路灯管理模式

从以往的‘被动巡检’转变至如今的‘主动预警’&#xff0c;塔能物联运维平台对路灯管理模式展开了重新构建。城市路灯属于极为重要的市政基础设施范畴&#xff0c;它的实际运行状态和市民出行安全以及城市形象有着直接且紧密的关联。不过呢&#xff0c;传统的路灯管理模式当下…

10. 常见的 http 状态码有哪些

总结 1xx: 正在处理2xx: 成功3xx: 重定向&#xff0c;302 重定向&#xff0c;304 协商缓存4xx: 客户端错误&#xff0c;401 未登录&#xff0c;403 没权限&#xff0c;404 资源不存在5xx: 服务器错误常见的 HTTP 状态码详解 HTTP 状态码&#xff08;HTTP Status Code&#xff0…

springBoot对接第三方系统

yml文件 yun:ip: port: username: password: controller package com.ruoyi.web.controller.materials;import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.materials.service.IYunService; import o…

【PTA数据结构 | C语言版】车厢重排

本专栏持续输出数据结构题目集&#xff0c;欢迎订阅。 文章目录题目代码题目 一列挂有 n 节车厢&#xff08;编号从 1 到 n&#xff09;的货运列车途径 n 个车站&#xff0c;计划在行车途中将各节车厢停放在不同的车站。假设 n 个车站的编号从 1 到 n&#xff0c;货运列车按照…

量子计算能为我们做什么?

科技公司正斥资数十亿美元投入量子计算领域&#xff0c;尽管这项技术距离实际应用还有数年时间。那么&#xff0c;未来的量子计算机将用于哪些方面&#xff1f;为何众多专家坚信它们会带来颠覆性变革&#xff1f; 自 20 世纪 80 年代起&#xff0c;打造一台利用量子力学独特性质…

BKD 树(Block KD-Tree)Lucene

BKD 树&#xff08;Block KD-Tree&#xff09;是 Lucene 用来存储和快速查询 **多维数值型数据** 的一种磁盘友好型数据结构&#xff0c;可以把它想成&#xff1a;> **“把 KD-Tree 分块压缩后落到磁盘上&#xff0c;既能做磁盘顺序读&#xff0c;又能像内存 KD-Tree 一样做…

【Mysql作业】

第一次作业要求1.首先打开Windows PowerShell2.连接到MYSQL服务器3.执行以下SQL语句&#xff1a;-- 创建数据库 CREATE DATABASE mydb6_product;-- 使用数据库 USE mydb6_product;-- 创建employees表 CREATE TABLE employees (id INT PRIMARY KEY,name VARCHAR(50) NOT NULL,ag…

(C++)STL:list认识与使用全解析

本篇基于https://cplusplus.com/reference/list/list/讲解 认识 list是一个带头结点的双向循环链表翻译总结&#xff1a; 序列容器&#xff1a;list是一种序列容器&#xff0c;允许在序列的任何位置进行常数时间的插入和删除操作。双向迭代&#xff1a;list支持双向迭代&#x…

Bash函数详解

目录**1. 基础函数****2. 参数处理函数****3. 文件操作函数****4. 日志与错误处理****5. 实用工具函数****6. 高级函数技巧****7. 常用函数库示例****总结&#xff1a;Bash 函数核心要点**1. 基础函数 1.1 定义与调用 可以自定义函数名称&#xff0c;例如将greet改为yana。❌…

Python爬虫实战:研究rows库相关技术

1. 引言 在当今数字化时代,互联网上存在着大量有价值的表格数据,这些数据以 HTML 表格、CSV、Excel 等多种格式存在。然而,由于数据源的多样性和不规范性,表格结构往往存在复杂表头、合并单元格、不规则数据行等问题,给数据的自动化处理带来了巨大挑战。 传统的数据处理工…

通过同态加密实现可编程隐私和链上合规

1. 引言 2023年9月28日&#xff0c;a16z 的加密团队发布了 Nakamoto Challenge&#xff0c;列出了区块链中需要解决的最重要问题。尤其是其中的第四个问题格外引人注意&#xff1a;“合规的可编程隐私”&#xff0c;因为Zama团队已经在这方面积极思考了一段时间。本文提出了使…

封装---统一封装处理页面标题

一.采用工具来实现(setPageTitle.ts)多个页面中用更统一的方式设置 document.title&#xff0c;可以封装一个工具函数:在utils目录下新建文件:setPageTitle.ts如果要在每个页面设置相同的网站标志可以使用下面的appNameconst appName: string import.meta.env.VITE_APP_NAMEex…

JAVA学习笔记 首个HelloWorld程序-002

目录 1 前言 2 开发首个程序 3 小结 1 前言 在所有的开发语言中&#xff0c;基本上首先程序就是输出HelloWorld&#xff0c;这里也不例外。这个需要注意的是&#xff0c;程序的核心功能是数据输出&#xff0c;是要有一个结果&#xff0c;可能没有输入&#xff0c;但是一定有…