美文网首页Spring
spring.jackson.property-naming-s

spring.jackson.property-naming-s

作者: commafu | 来源:发表于2019-03-04 13:05 被阅读0次

    在springboot的一个新模块里,我设置了
    spring.jackson.property-naming-strategy=CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES
    但是在http请求和响应内容里,POJO的驼峰属性名和JsonObject下划线属性名均未互转。

    阅读文档发现 CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES已经被弃用了, 使用SNAKE_CASE代替,但是我设置为SNAKE_CASE后仍不生效。

    发现是自己 @Bean com.fasterxml.jackson.databind.ObjectMapper springboot自动转换属性名也使用了该ObjectMapper,自定义配置覆盖了springboot的自动配置。

    相关文章

      网友评论

        本文标题:spring.jackson.property-naming-s

        本文链接:https://www.haomeiwen.com/subject/wyvbuqtx.html