From the course: Spring Boot 2.0 Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Web services with Spring Boot

Web services with Spring Boot

From the course: Spring Boot 2.0 Essential Training

Start my 1-month free trial

Web services with Spring Boot

- [Instructor] Since we are dealing with the web application, now it's a great time to talk about web services with Spring. Spring Boot web services use an MVC implementation. The pattern is exactly the same as web applications. But in the case of web services, the view is the content type of the page, not HTML. You use RestController instead of Controller in order to not map to a view. Instead, an object that has been marshaled is returned. And once again, you get JSON as the default output type for the view. You can add things like XML if you choose to. Now, I'm going to build off my solution from the last chapter to make it easier. But let's take a look at how to build a web service in our existing application. In our room-web-app, I want to open up src, main, java, our default package, and then the controllers. And we're going to create a new controller. We're going to call this RoomRestController. We'll annotate this…

Contents