Skip to content

Property naming strategy for Jackson integration does not work #1900

Open
@billysoderlund

Description

Description

I am trying to deserialize json with snake case json properties to entity views with lower camel case properties. I have tried to add the strategy to both the jackson object mapper builder and the entity view aware object mapper without success. It works for regular classes and interfaces but not entity views. Am I missing something here or is this a bug?

Expected behavior

Properties like "created_at" should deserialize to "createdAt".

Actual behavior

Properties does not get set and end up being null.

Steps to reproduce

    @Bean
    fun jsonCustomizer(): Jackson2ObjectMapperBuilderCustomizer =
        Jackson2ObjectMapperBuilderCustomizer { it
            .serializers(LifeCycleStatusSerializer())
            .propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
        }

    @Bean
    fun evaObjectMapper(evm: EntityViewManager, mapper: ObjectMapper): EntityViewAwareObjectMapper {
        mapper.propertyNamingStrategy = PropertyNamingStrategies.SNAKE_CASE
        return EntityViewAwareObjectMapper(evm, mapper)
    }

Environment

Version: 1.6.11
JPA-Provider: Spring Data JPA
DBMS: MySQL
Application Server: Spring Boot

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions