Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is Spring Boot 2.x and build Hello World

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces what is Spring Boot 2.x and the construction of Hello World, the content is very detailed, interested friends can refer to, hope to be helpful to you.

What is Spring Boot?

Before we use it, let's take a look at what Spring Boot is. Literally, it is a guide to Spring. It simplifies the complicated configuration in Spring, has conventions over configuration, and embeds Servlet. The container mostly uses some default automatic configuration, and integrating our commonly used packages into a starter can help us quickly build an application, simplify development, and solve the pain points of some xml files. After all, both properties files and yml look very simple, greatly improving the readability of the code.

Build a HelloWorld project

Needless to say, let's start building a Spring Boot project, which I usually use in two ways:

SpringBoot official website

The official website of Spring provides a tool, and we can see this picture when we open it.

Here we choose Web,JPA,DevTools as our initial build package, and then we click the green button to get a generated zip package, unzip it and get a folder, which is the project we want.

Then use IDE (idea is recommended) to open it ~

IDE

The second way is to use IDE (integrated development environment) to build, here I use idea.

Click File-> New-> Project, and you will get the following page

When you click Next, you will get the following page

After filling in the information in turn, click Next

Select some of the modules we need (just choose Web if you are just writing HelloWorld here). We will explain the use of these modules later, and we can choose them on a case-by-case basis. Then click Next, select a storage path to open and wait for the download dependency to see that the project has been built successfully.

Write the first HelloWorld program

Create a new HelloWorld class in the controller folder shown above

Here, I always failed to call because the default port 8080 was occupied. Later, I configured the port number in application.properties:

Visit http://localhost:8081/hello/world. A HelloWorld program has been written. The following article will analyze the process ~

On what is Spring Boot 2.x and building Hello World to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report