In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use springboot to complete a simple web application", the explanation content in the article is simple and clear, easy to learn and understand, please follow the idea of Xiaobian slowly in-depth, together to study and learn "how to use springboot to complete a simple web application"!
profile
Spring Boot has become the most popular microservices development framework today, and this article is a guide to how to quickly start Web microservices development using Spring Boot, where we create a runnable Jar package that contains an embedded Web container (Tomcat by default).
Traditional Spring applications need to configure a large number of XML files to run, but with Spring Boot, you can quickly get a functioning Spring application with very little configuration, and these configurations are in the form of annotations, no need to configure XML.
SpringBoot's main advantages:
1) Build projects quickly.
2. No configuration integration to mainstream development frameworks.
3, the project can run independently, without external dependence Servlet container.
4. Provide a series of functional features of enterprise-level projects (such as security, health detection, external configuration, database access, restful construction, etc.).
5. Improve the efficiency of development and deployment.
purpose of this chapter
Complete a simple web (springmvc) application using springboot, browser access output "HelloWord"
system requirements
1. jdk1.8
2. springboot 2.1.6.RELEASE
3. Development Tools (IntelliJ IDEA 2018.1.5 x64)
6. apache maven (3.6.0, this chapter uses maven to manage jar packages, please find information for specific configuration environment variables and use)
Start building projects
Open the tool, and the interface is as follows:
Fig. 1
We click Create New Project to create a new project. As follows:
Fig. 3
Continue Next as follows:
1) Recommended to use Lombok plug-in development. Save a lot of things, such as get set log definition, etc., will open a separate chapter to explain.
2) Select the web-starter module.
Fig. 5
Continue Next as follows:
Fig. 7
Fig. 9
At this point, the idea to create boot project is complete, there is another way to download the project from the official website (i.e. https://start.spring.io/), and then introduce it, it is also relatively simple, no longer detailed.
Description of project composition
1).gitignore--Configuration file for distributed version control system git, meaning ignore commit
In the.gitingore file, follow the syntax and specify an ignore rule on each line. For example:
FIG. 11
2) mvnw--the full name is maven wrapper. Its principle is to record the maven version you want to use in the maven-wrapper.properties file. When the user executes the mvnw clean command and finds that the current user's maven version is inconsistent with the expected version, then download the expected version and execute the mvn command with the expected version, such as the mvnw clean just now. He will execute mvn clean with version 3.6.0 of maven.
mvn folder--holds maven-wrapper.properties and related jar packages
mvn.cmd--cmd entry for executing mvnw command
FIG. 13
3) pom.xml--maven The main program looks like this:
FIG. 15
a: The project depends on spring-boot-starter-parent, mainly introducing some default jar package files, plug-ins, etc.
b: Some configurations such as group and artifact of the project
c, e: jar packages on which the project depends
d, f: maven plug-in in the project, you can click directly to run
HelloWord
1) Build packages and classes in turn
FIG. 17
See this log to indicate that embedded tomcat has been successfully started, and the default port number 8080
FIG. 19
Thank you for reading, the above is "how to use springboot to complete a simple web application" content, after learning this article, I believe we have a deeper understanding of how to use springboot to complete a simple web application, the specific use of the situation also needs to be verified. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
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.