ObjectMapper
文章平均质量分 77
weixin_44012070
这个作者很懒,什么都没留下…
展开
-
spingboot2.x中restTemplate的Jackson序列化问题
RestTemplate是Spring提供的远程调用客户端,调用RestTemplate的默认构造函数,RestTemplate对象再底层通过使用java.net包下的实现常见HTTP请求;这种方式创建的ObjectMapper会导致通过Jackson2ObjectMapperBuilderCustomizer配置默认的序列化/反序列配置用不上,如LocalDateTime.class的序列化/反序列化。常见RestTemplate对象放入Spring容器中,内部通过new的方式创建了。原创 2023-06-19 15:43:09 · 992 阅读 · 0 评论 -
springboot2.x中jackson中objectMapper相关
SpringBoot2.x自动装载MappingJackson2HttpMessageConvereter消息转换器,MappingJacson2HttpMessageConverter会获取容器中ObjectMapper的配置,来进行Jackson的序列化和反序列化。当需要自定义序列化/反序列化的配置时,就需要对ObjectMapper进行配置。注:SpringBoot2.x中不要将自定义的PObjectMapper对象放入Spring容器中,否则会导致默认的ObejctMapper配置被覆盖掉。原创 2023-06-19 10:43:09 · 493 阅读 · 1 评论