From the course: Spring Boot 3 Essential Training
Creating a project - Spring Boot Tutorial
From the course: Spring Boot 3 Essential Training
Creating a project
- [Instructor] We're going to jump right into the code in this course, and we will do so by creating our first project. Now there are several ways to create a Spring Boot project, including using Start.Spring.io or the Spring initializer. But in this course, I'm just going to use the plugin from my IDE. Your IDE should have something similar. And if it doesn't, you can always go to start.spring.io to create the projects that you need. I'm going to start by showing you what this looks like. This is the Spring initializer, and I've actually pre-populated it with what we are going to choose in the IDE plugin that I'm going to use. When you generate this project, it will download a zip file that you can unpack into your working directory if you choose to do it that way or if that is your only option. But in my IDE, I'm going to select a new module. I'm going to select Spring Boot. I'm going to name it Booting. Select Java and Maven. We will leave my group the same because it's already pre-populated for me com.FrankMoley and then LIL for LinkedIn Learning. I'm going to select Java 21, and the packaging will be Jar. Now the only dependency that I'm going to bring into this is Spring Web, and we'll go ahead and create this project. Now Maven should download files for you, and at this point, you actually can run this application if you choose to. But before we do that, I'm going to ask you to navigate to source, main, resources. And in the static directory we will create a new file called index.html. So we're going to do an H1 tag, and I'm going to put Hello, LinkedIn Learning. Now with that said, I can run this application. There's a couple ways to do that. First of all, if you go to the booting application, which you get for free. You will get a Spring Boot application as part of the starter. You can simply run it. Each IDE is a little bit different, but there's always a way to run it here. Now I have a command up here that will automatically run this application because it is built into the IDE. So I'm just going to run this, and it's going to pop up in a console window, and you'll see that everything has started. And the second to last message is the one that we're most interested in. It says Tomcat started on Port 8080. So I'm going to navigate back to my browser, and we're going to go to local Host 8080, and you'll see that the page is displayed. Now this actually was served from the application, and I can prove that to you by going to foo, and I'm going to get a Whitelabel error page. And that's because we haven't defined a path to /foo. So Spring is actually generating a 404. It's called a Whitelabel Error Page because we haven't defined a 404 error page. But nonetheless, this application is running and has served a webpage to us at Index, and that's all there is to creating a Spring Boot application. Now, of course, that's just the beginning, but it gives you a sense to the speed of developing an application with Spring Boot.
Contents
-
-
-
Creating a project3m 18s
-
(Locked)
Understanding the project4m 30s
-
(Locked)
Understanding auto-configuration4m 44s
-
(Locked)
Configuration in Spring Boot5m 43s
-
(Locked)
Spring Profiles in Boot7m 30s
-
(Locked)
Building Spring Boot applications3m 20s
-
(Locked)
Containerizing Spring Boot applications5m 48s
-
-
-
-
-
-