From the course: Learning Spring with Spring Boot

Schalten Sie den kompletten Kurs noch heute frei

Join today to access over 23,300 courses taught by industry experts.

Solution: RESTful endpoints

Solution: RESTful endpoints - Spring Tutorial

From the course: Learning Spring with Spring Boot

Solution: RESTful endpoints

"

(upbeat music) - [Instructor] So now it's time for my Solution to the RESTful Web Service. Let's start in our Web Service Controller. So you'll see that I added three methods to this, a GetMapping. And I didn't talk about GetMapping before, I only talked about Request Mapping. Within Spring and some of the later versions of Spring Boot, they introduced these stereotypes of GetMapping, Post mapping, PutMapping, and Delete Mapping. So you didn't have to put a method in the Request Mapping annotation itself. So essentially it's doing the same thing. And I wanted to show that to you. So I used the GetMapping at /guests, and I simply returned in that service, a list of hotel guests from the reservation service. I did the same to add a guest, doing a PostMapping at /guests. I then have a response status have created, because anytime you create an element in REST, you should return it to a one instead of a 200. Now…

Inhalt