From the course: Complete Guide to Spring MVC
Unlock this course with a free trial
Join today to access over 24,600 courses taught by industry experts.
Create a web controller - Spring Tutorial
From the course: Complete Guide to Spring MVC
Create a web controller
- [Instructor] Okay. So now we want to create our web controller. To start off, for those that ran their application earlier, go ahead and stop your server, and then right-click into our main class here. Go to New, and we want to create a new Java class. Let's name this Java class GreetingController. So type in GreetingController. There you go. Select Enter. Go into our GreetingController. Okay. If you skipped the basics, you may already have this, but for those that are going step by step, let's follow along. So what we're going to do is go ahead above our public class here, we're going to add the annotation of Controller. You can go ahead and select that there. And you see above, we have controller imported for us. And when you hover over any of the annotation, it gives you some helpful information as well as links that you can go into if you would like to dig deeper, okay? All right, let's go into our public class here. Go ahead and use GetMapping. I'm go ahead and let you know…
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
-
-
-
What you will build and what you need2m 50s
-
Start from scratch vs. skipping the basics1m 41s
-
(Locked)
Starting with Spring Initializr4m 49s
-
(Locked)
Skip basics: Source repository for this guide1m 46s
-
(Locked)
Create a web controller9m 13s
-
(Locked)
Spring Boot devtools4m 45s
-
(Locked)
Run the application2m 38s
-
(Locked)
Test the application2m 7s
-
(Locked)
Add a home page5m 11s
-
(Locked)
Summary and next steps4m 57s
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-