In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What are the three construction methods of SpringBoot project? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
The main purpose of SpringBoot is to simplify the configuration file, through a small number of configurations to run Java programs, its powerful automatic configuration function to help developers easily achieve configuration assembly, through the introduction of SpringBoot starter can achieve the desired functions without the need for additional configuration.
Currently, there are three ways to build a SpringBoot project:
Create a project through Spring Initializr create a project manually through IDEA
Official generation tool
The Spring team provides a very convenient web page for generating SpringBoot projects. Open a browser and enter Spring Initializr:
List of project generation parameters:
Project: project type (Maven and Gradle build tools are supported) Language: main languages of the project can be selected as needed: Java, Kotlin, Groovy SpringBoot:SpringBoot version ProjectMatedata: with Group and Artifact configuration Dependencies: project dependency
Click Generate to download the project when the parameters are set, import the project using IDEA after completion, open the project synchronization and run it.
IDEA creation Project
Newer versions of IDEA have built-in plug-ins to create SpringBoot projects, and the creation principle is also using Spring Initializr to create projects, as shown in the creation process:
Open the IDEA development tool, select file-> new-> project menu, select Spring Initializr in the new dialog box, and click Next to create the SpringBoot project.
Finally, add the main method to start the application:
@ SpringBootApplication@Slf4jpublic class SpringEnvApplication {public static void main (String [] args) {ConfigurableApplicationContext context = SpringApplication.run (SpringEnvApplication.class, args);}}
Manually create a SpringBoot project
In addition to the above two methods, you can also create a SpringBoot project manually, create an empty Maven project through IDEA, and then specify the dependencies of SpringBoot. The basic process is as follows:
Open the IDEA development tool, select file-> new-> project menu in the new dialog box, select Mavenn and click Next to complete the project creation as prompted.
After the project is created, open the pom.xml file and set the parent configuration of pom.xml:
Org.springframework.boot
Spring-boot-starter-parent 2.2.0.RELEASE
Add the SpringBoot Maven packaging plug-in:
Org.springframework.boot
Spring-boot-maven-plugin
Add the main method to start the application:
@ SpringBootApplication@Slf4jpublic class SpringEnvApplication {public static void main (String [] args) {ConfigurableApplicationContext context = SpringApplication.run (SpringEnvApplication.class, args);}}
Complete pom.xml file:
4.0.0
Org.springframework.boot
Spring-boot-starter-parent
2.2.0.RELEASE
Com.csbaic.arch
Spring-env
0.0.1-SNAPSHOT
Spring-env
1.8
Org.springframework.boot
Spring-boot-starter
Org.springframework.boot
Spring-boot-maven-plugin
Once you have set up parent and plug-ins, you can use SpringBoot to create applications.
The answers to the questions about the three construction methods of the SpringBoot project are shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.