How to design a Spring MVC REST service?

前端 未结 2 1247
太阳男子
太阳男子 2021-02-02 04:36

I want the client and server application to talk to each other using REST services. I have been trying to design this using Spring MVC. I am looking for something like this:

2条回答
  •  有刺的猬
    2021-02-02 04:44

    Yes, Rest is very easy to implement using spring MVC.

    @RequestMapping(value="/saveEmploee.do",method = RequestMethod.POST)
    @ResponseBody
    public void saveEmployee(@RequestBody Class myclass){
        //saving class.
        //your class should be sent as JSON and will be deserialized  by jackson
        //bean which should be present in your Spring xml.      
    }
    

提交回复
热议问题