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
From the course: Spring Boot 2.0 Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Understanding Spring Boot dependencies6m
-
Configuring embedded Tomcat5m 6s
-
Employing MVC in Spring Boot2m 1s
-
Thymeleaf templates4m 42s
-
Web application with Spring Boot4m 25s
-
Challenge: Generate an MVC webpage1m
-
Solution: Generate an MVC webpage2m 20s
-
Web services with Spring Boot3m 13s
-
Challenge: Build a web service38s
-
Solution: Build a web service1m 55s
-
-
-
-