How to process a multipart request consisting of a file and a JSON object in Spring restful service?

前端 未结 9 1215
一生所求
一生所求 2020-12-08 07:47

I have the following resource (implemented using Spring 4.05.RELEASE) which accepts a file and a JSON object:

(P.S. activityTemplate is a serializable entity class)<

9条回答
  •  猫巷女王i
    2020-12-08 08:46

    Couldn't you change your

    @RequestMapping(value="/create", method=RequestMethod.POST)
    

    to

    @RequestMapping(value="/create",
                    method=RequestMethod.POST, consumes ={"multipart/form-data"})
    

提交回复
热议问题