使用Spring Data REST时如何更改Jacksons配置?

使用Spring Data REST时如何更改Jacksons配置?,第1张

使用Spring Data REST时如何更改Jacksons配置

您可以(可能应该)

RepositoryRestConfigurerAdapter
(在Spring Data Rest
2.4中)或
RepositoryRestMvcConfiguration
公开
configureObjectMapper
方法

@Configurationclass RepositoryRestAdapterConfiguration extends RepositoryRestConfigurerAdapter {    @Override    public void configureJacksonObjectMapper(ObjectMapper objectMapper) {        objectMapper.registerModule(new JavaTimeModule());        objectMapper.disable( SerializationFeature.WRITE_DATES_AS_TIMESTAMPS );    }}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5153007.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-18
下一篇 2022-11-18

发表评论

登录后才能评论

评论列表(0条)

保存