This article will be based on the official website tutorial, step by step initialization, build springboot project, feel the springboot scaffolding content

Reference Documents:

  • Liverpoolfc.tv: spring. IO/projects/sp…
  • Website quick startThis article mainly refers to the steps:spring.io/quickstart
  • IO/start.spring. IO /
  • Download maven repository: maven.apache.org/download.cg…
  • Refer to steps article: www.cnblogs.com/toutou/p/96…

Operating environment:

  • System environment: MacOS Big SUR
  • Editor: Intellij Idea Community Editor
  • Java version: 17.0.1

1. Initialize scaffolding on the official website

The official website provides a visual and very convenient initialization method: start.spring. IO /

Just follow the steps and choose

However, it is important to include web dependencies, because QuickStart instructs you to start a Web project through SpringBoot, so if you do not include Web dependencies and use the dependency free version directly, you will have problems with org.SpringFramework. web dependencies

Then click “Generate” to download a zip package

2. Decompress the package and use the IDEA editor to open the package

2.1 unzip

2.2 Editor Opens the project folder

3. Copy the code and fill in the corresponding Java file

Note that the class name, package name, etc. should be changed to the name you set:

4. Build the project

4.1 Troubleshooting Maven error in build:

If you open idea, you will automatically start downloading maven dependencies and build projects.

Always resolve a plugin org, apache maven. Plugins: maven - site - the plugin: 3.3

The maven-site-plugin plugin cannot be found in the current project’s Maven library

Reference blog.csdn.net/panshi5188/… After the article, the following measures were taken to deal with it:

4.1.1 Downloading the Maven Library Again

Download address: maven.apache.org/download.cg…

Note: I can only open the Official website of Maven if I have to access my mobile hotspot. The company’s Internet cannot access 🤷🏻♀️. If you can’t access the mobile hotspot, consider scientific Internet access methods

4.1.2 Decompressing the Downloaded Maven libraries

4.1.3 Importing the library into IDEA

  1. In preference of idea, open Build, Execution, Deployment >> Build Tools >> Maven configuration

  2. Modify the User Settings file and Local Repository paths

  3. Click Apply and OK to save the configuration

4.2 Rebuild the Project

At this point, no errors are reported

4.3 run the project

5. View the Hello World page as prompted by Quick Start

Open: http://localhost:8080/hello

6. Manually import Maven dependencies

What if we wanted to add some new Maven dependencies through a blank Springboot template in the middle of the project?

First of all, we still generate a blank template without dependencies on the official website, write related code

Then, in the pom.xml file, add a dependency for the configuration of the web above:

The following icon appears in the upper right corner of the IDE. Click to update the dependency

Finally, build and Run projects as usual are ready to run

Of course, it would be more convenient to install the non-community version of IDEA