How to return JSON data from spring Controller using @ResponseBody

后端 未结 8 1115
情深已故
情深已故 2020-11-27 04:55

Spring version 4.2.0, Hibernate 4.1.4 Here is my Controller function:

@RequestMapping(value = \"/mobile/getcomp\", method = Req         


        
8条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 05:42

    Considering @Arpit answer, for me it worked only when I add two jackson dependencies:

    
        com.fasterxml.jackson.core
        jackson-core
        2.4.3
    
    
        com.fasterxml.jackson.core
        jackson-databind
        2.4.3
    
    

    and configured, of cause, web.xml .

    Original answer that helped me is here: https://stackoverflow.com/a/33896080/3014866

提交回复
热议问题