V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Str0Dytomh
V2EX  ›  程序员

关于 jackson 的 @JsonSerialize 注解

  •  
  •   Str0Dytomh · 2023-02-03 16:45:15 +08:00 · 847 次点击
    这是一个创建于 419 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    @JsonSerialize(using = BigDecimal2StringJsonSerializer.class )
    BigDecimal money;
    BigDecimal money2;
    BigDecimal money3;
    
    2 条回复    2023-02-03 17:05:57 +08:00
    newaccount
        1
    newaccount  
       2023-02-03 16:54:23 +08:00
    注册全局 formatter?

    WebMvcConfigurer.addFormatters
    beetlerx
        2
    beetlerx  
       2023-02-03 17:05:57 +08:00
    ObjectMapper.registerModule()
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5463 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 08:52 · PVG 16:52 · LAX 01:52 · JFK 04:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.