SpringBoot3 basic framework integration study notes_basic framework construction (2)

Table of contents

1. Preparation

2. Quickly generate frameworks


1. Preparation

Since we are using springboot3 as the basic framework this time, there are some configuration requirements that are slightly different from the previous framework. At least you need to make the following preparations for the next work:

  1. If you have a computer with Internet access, as you can see this note, I think it is not difficult for you to have a computer with Internet access;
  2. Your computer has 8G or above memory and 80G or above hard drive; I don’t need to tell you about the other things, right? For example, monitor, mouse, keyboard...
  3. JDK17 needs to be installed on your computer. Note that it is JDK17. This is a hard standard; the previous version JDK8 is sufficient. JDK17 download address: Java Downloads | Oracle
  4. Maven3.6 or above is installed on your computer; Maven3.9 download address: https://dlcdn.apache.org/maven/maven-3/3.9.0/binaries/apache-maven-3.9.0-bin. zip (Get the latest version. If you have any problems after using it, please let me know.)
  5. Finally, you need to install an IDE on your computer, either Eclipse or IntelliJ IDEA, but I use IntelliJ IDEA, so it is recommended that you install IntelliJ IDEA; IntelliJ IDEA download address: https://www.jetbrains.com/idea /

It seems that these are enough to build the basic framework for now. We will talk about the components or software used later.

2. Quickly generate frameworks

The main reason why we need to generate a framework quickly is because we are lazy!

The author uses IntelliJ IDEA, so you can use IDEA's springboot plug-in to generate it, as shown below:

Figure 1

Figure II

Just click the create button (Figure 2).

This process will take a long time, and you need to wait patiently.

After completion, the code will be automatically imported into the IDE, and the imported view will be as follows:

Figure 3

As shown in "Figure 3", the following is the directory and file description corresponding to this project:

springboot3-keenly--project name

 .idea------------IDE automatically generates configuration files (don't worry about it for now)

 src--------------Source code folder

    main----main source code folder

    java----java source code folder

      com----java package name

        keenly----java package name

          springKeenly---- java package name

             SpringKeenlyApplication.java---main function

    resources---system configuration folder

       application.properties----system configuration file

    test----test source code folder

.gitignore------File filtering configuration to facilitate publishing to git (not required)

LICENSE-----Source code agreement file, added by yourself (not required)

mvnw------maven command file

mvnw.cmd---- maven command file

pom.xml---- maven project management configuration file

README.md---a file introducing the project (optional)

Are you all curious about what source code is generated? Don’t worry, I have pulled out some necessary documents to show you:

  1. SpringBoot main program entrance (SpringKeenlyApplication.java):
package com.keenly.springKeenly;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringKeenlyApplication {

   public static void main(String[] args) {
      SpringApplication.run(SpringKeenlyApplication.class, args);
   }

}
  1. Maven configuration file (pom.xml)
3)	<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>3.1.0-SNAPSHOT</version>
      <relativePath/> <!-- lookup parent from repository -->
   </parent>
   <groupId>com.keenly</groupId>
   <artifactId>springboot3-keenly</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>springboot3-keenly</name>
   <description>这是一个springboot3基础功能演示以及相应技术整合的项目</description>
   <properties>
      <java.version>17</java.version>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter</artifactId>
      </dependency>

      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-test</artifactId>
      </dependency>

   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
         </plugin>
      </plugins>
   </build>
   <repositories>
      <repository>
         <id>spring-milestones</id>
         <name>Spring Milestones</name>
         <url>https://repo.spring.io/milestone</url>
         <snapshots>
            <enabled>false</enabled>
         </snapshots>
      </repository>
      <repository>
         <id>spring-snapshots</id>
         <name>Spring Snapshots</name>
         <url>https://repo.spring.io/snapshot</url>
         <releases>
            <enabled>false</enabled>
         </releases>
      </repository>
   </repositories>
   <pluginRepositories>
      <pluginRepository>
         <id>spring-milestones</id>
         <name>Spring Milestones</name>
         <url>https://repo.spring.io/milestone</url>
         <snapshots>
            <enabled>false</enabled>
         </snapshots>
      </pluginRepository>
      <pluginRepository>
         <id>spring-snapshots</id>
         <name>Spring Snapshots</name>
         <url>https://repo.spring.io/snapshot</url>
         <releases>
            <enabled>false</enabled>
         </releases>
      </pluginRepository>
   </pluginRepositories>

</project>

Yes, these are the files generated this time. Others are irrelevant files or automatically generated configuration files. Basically, we don’t need to pay attention to them for the time being.

Maybe the source code structure you generated is different from mine, it doesn't matter, as long as the src directory and pom.xml file are there, everything else is easy.

Continue to move forward, as shown in "Figure 3", select the "SpringKeenlyApplication.java" file, right-click, and the following interface will appear:

Figure 4

Click "run..." in "Figure 4" to run the system. The running effect is as follows:

This way our framework is complete!

Guess you like

Origin blog.csdn.net/tiehou/article/details/129566973