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

关于 jackson 的 @JsonSerialize 注解

  •  
  •   Str0Dytomh · Feb 3, 2023 · 1331 views
    This topic created in 1201 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
        1
    newaccount  
       Feb 3, 2023
    注册全局 formatter?

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