0

I have a requirement in which CRUD operations need to be exposed through REST web services with Spring and Hibernate. Presentation is through JSF. It would be of great help if I can get a sample code for this.

1 Answer 1

2
@Controller
@RequestMapping("/foo")
public class FooController {

     @Inject private FooService service;

     @RequestMapping("/create", method=RequestMethod.PUT)
     public void create(@Valid Foo foo) { .. }

     @RequestMapping("/retrieve", method=RequestMethod.GET)
     public String retrieve(@RequestParam String fooId { .. }

     //etc for POST and DELETE
}

(Sometimes people tend to skip the request method limitation, but it feels more RESTful that way)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.