This video covers building the first controller and explains how the underlying service layers are utilized to build models for the views you will build.
- [Frank] Now it's time…to actually build that controller we just talked about.…As we have done several times here…we are going to start with a package…and in our com. in my case Frank Moley folder…we are going to build a landon.web.application folder.…In that folder we're going to create a Java class…and we are going to call this the ReservationController.…Now there's a little bit of thought…into how to build controllers.…
There's really no right or wrong way.…I prefer to build a controller per URL path…and then have no more than five methods in there…one for head, if I'm going to respond…specifically to a head request.…Maybe six if I'm going to deal with patch…but then the other four…are really for post, put, delete, and get.…That's how I go forward.…I tend to write a lot more web services…than web applications…and that just seems to make sense with that respect…but for the purpose of this…we're just going to stick with our one controller.…
We need to annotate this class…with the @Controller annotation.…We also need to, as I mentioned…
- Creating a project with Spring Initializr
- Examining the Spring Boot skeleton project with Spring Data JPA
- Creating an embedded database for Spring Boot development and testing
- Building a service abstraction
- Using the IoC paradigm in Spring to develop a service layer
- Building a controller
- Testing a controller MockMvc
- Exposing a service layer through REST
Skill Level Intermediate
Q: This course was updated on 09/06/2018. What changed?
A: The following topics were updated: creating a project with Spring Initializr, examining the Spring Boot skeleton project, developing a service object with Spring, and testing a controller MockMvc.