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

关于 jackson 的 @JsonSerialize 注解

  •  
  •   Str0Dytomh · Feb 3, 2023 · 1354 views
    This topic created in 1218 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   ·   2740 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 05:25 · PVG 13:25 · LAX 22:25 · JFK 01:25
    ♥ Do have faith in what you're doing.