In Spring Boot, adding a custom converter by extending MappingJackson2HttpMessageConverter seems to overwrite the existing converter

前端 未结 2 1626
自闭症患者
自闭症患者 2021-01-02 17:31

I\'m trying to create a converter for a custom media-type like application/vnd.custom.hal+json. I saw this answer here, but it won\'t work since you don\'t have

2条回答
  •  不知归路
    2021-01-02 18:16

    Spring boot docs explicitly states that adding a custom MappingJackson2HttpMessageConverter replaces the default value.

    From docs:

    Finally, if you provide any @Beans of type MappingJackson2HttpMessageConverter then they will replace the default value in the MVC configuration. Also, a convenience bean is provided of type HttpMessageConverters (always available if you use the default MVC configuration) which has some useful methods to access the default and user-enhanced message converters.

提交回复
热议问题