【问题标题】:Model mapper to support both camel case and snake case模型映射器支持骆驼案例和蛇案例
【发布时间】:2021-10-06 06:43:10
【问题描述】:

我有一个 Java POJO 类

例如:

public class Student {
String name;
String rollNo;
}

我有返回上述 bean 类的其余 API。有些人在蛇盒中返回这个,例如roll_no。如何使模型映射器配置为同时接受蛇案例和骆驼案例序列化。

【问题讨论】:

标签: java spring-boot modelmapper


【解决方案1】:

此注释可能对您有所帮助:

@JsonAlias({"roll_no", "rollNo", "rollno"})
String rollNo;

如果您想了解更多详情,请点击此链接@JsonAlias anotation

【讨论】:

    猜你喜欢
    • 2022-06-21
    • 2020-02-10
    • 2017-05-08
    • 1970-01-01
    • 2019-10-30
    • 1970-01-01
    • 2022-06-11
    • 1970-01-01
    • 2021-08-31
    相关资源
    最近更新 更多