• 请不要在回答技术问题时复制粘贴 AI 生成的内容
Str0Dytomh
V2EX  ›  程序员

关于 jackson 的 @JsonSerialize 注解

  •  
  •   Str0Dytomh · Feb 3, 2023 · 1653 views
    This topic created in 1368 days ago, the information mentioned may be changed or developed.

    需要每个字段都加上吗,有没有办法同一种类型的字段只要加一次

    @JsonSerialize(using = BigDecimal2StringJsonSerializer.class )
    BigDecimal money;
    BigDecimal money2;
    BigDecimal money3;
    
    2 replies  •  2023-02-03 17:05:57 +08:00
    newaccount
    newaccount
    Feb 3, 2023
    1
    注册全局 formatter?

    WebMvcConfigurer.addFormatters
    beetlerx
    beetlerx
    Feb 3, 2023
    2
    ObjectMapper.registerModule()
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4765 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 03:49 · PVG 11:49 · LAX 19:49 · JFK 22:49
    ♥ Do have faith in what you're doing.