Spring @ModelAttribute Model field mapping

前端 未结 2 1432
感动是毒
感动是毒 2021-01-20 22:24

I am rewriting an old REST service written in an in-house framework to use Spring. I have a Controller with a POST method which takes a parameter either as a POST or as

2条回答
  •  爱一瞬间的悲伤
    2021-01-20 22:59

    The @JsonProperty annotation can only work with the JSON format, but you're using x-www-form-urlencoded.

    If you can't change your POST type, you have to write your own Jackson ObjectMapper:

    @JsonProperty not working for Content-Type : application/x-www-form-urlencoded

提交回复
热议问题