How do I correctly reuse Jackson ObjectMapper?

前端 未结 4 466
耶瑟儿~
耶瑟儿~ 2021-02-01 12:10

I am happy with how the ObjectMapper works and general use within my application. What I would like to understand is the best way to implement the ObjectMapper to ensure it is r

4条回答
  •  悲&欢浪女
    2021-02-01 12:37

    It's fine to use a single instance per application provided you don't call any configuration methods after it's been made visible i.e. you should do all your initialization inside a static block.

提交回复
热议问题