Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RestController
- public class MessageController {
- MessageService messageService = new MessageService();
- //http://localhost:8084/SpringREST/api/messages
- @RequestMapping(
- value = "/api/messages",
- method = RequestMethod.GET,
- produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Collection<Message>> getMessages() {
- Collection<Message> messages = messageService.getAllMessages();
- return new ResponseEntity<Collection<Message>>(messages, HttpStatus.OK);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement