Jackson annotations being ignored in Spring

后端 未结 5 2081
日久生厌
日久生厌 2020-12-08 22:13

I\'m trying to make a property in a domain class hidden but it keeps appearing in the outputted JSON. I\'m using Jackson 2.0 and Spring 3.1.1

Output of /users/1:

5条回答
  •  不知归路
    2020-12-08 22:54

    The problem is that Spring doesn't work with Jackson 2.0. This has been solved in the following way:

    
    
    
            
                
                    
                
            
            
        
    

    And the own.implementation.of.MappingJacksonHttpMessageConverter is based on this:

    http://www.jarvana.com/jarvana/view/org/springframework/spring-web/3.0.0.RELEASE/spring-web-3.0.0.RELEASE-sources.jar!/org/springframework/http/converter/json/MappingJacksonHttpMessageConverter.java?format=ok

    But use ObjectMapper and other Jackson classes from Jackson 2.0 instead of Jackson 1.*

提交回复
热议问题