Spring MappingJacksonJsonView, how to tell to use it instead of JSP view?

后端 未结 4 1774
慢半拍i
慢半拍i 2021-01-03 07:30

I\'m trying to use MappingJacksonJsonView with Spring 3.0, without success. I don\'t know what I\'m doing wrong, I think the problem is that I don\'t know how t

4条回答
  •  既然无缘
    2021-01-03 08:29

    You should do it this way:

    In your xml file set the following: set

    
    

    After it you need to set Jackson serializer:

    
     
    
      
        
      
    
    
    

    after it you can use it in your Controller:

    @RequestMapping(value="/getObjects",method = RequestMethod.POST)
         @ResponseBody
         public  List getCategories(){
         List objects = daoService.gettAllObjects();
         return objects;
        }
    

提交回复
热议问题