当前位置:网站首页>02_ Springboot starter case
02_ Springboot starter case
2022-06-24 23:06:00 【Book opens autumn maple】
1. Create an empty project Empty Project

2. The project file name is SpringBoot

3. choice Create create

4. choice File --》New --》Moudle Create a module

5. Select the information configuration associated with naming this item

6. choice Web --》Spring Web
7. Introduction to project structure
(1) .mvn|mvnw|mvnw.cmd: Use script operations to perform maven Relevant command , Less used in China , Deleting
(2) .gitignore: Use version control tools git When , Set something that ignores submission
(3) static|templates: The following is the directory where the files are stored in the template technology
static: Put some static content css js img
templates: Template based html
(4)application.properties:SpringBoot Configuration file for , Many integrated configurations can be in this file To configure , for example :Spring、springMVC、Mybatis、Redis etc. . It's empty at the moment
(5) Application.java:SpringBoot The entry of program execution , Execute... In the program main Method ,SpringBoot And it started , Auto start built in tomcat function
8. Introduce SpringBoot Start the entry class

9. pom.xml Default auto configuration details
<?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>
<!-- Inherit SpringBoot A parent project of the framework , All self-developed Spring Boot Must inherit -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<!-- Current project GAV coordinate -->
<groupId>com.suke.springboot</groupId>
<artifactId>springboot-first</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!--maven Project name , You can delete -->
<name>001-springboot-first</name>
<!--maven Project description , You can delete -->
<description>001-springboot-first</description>
<!--maven Attribute configuration , It can be passed elsewhere ${} Reference in different ways -->
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--SpringBoot frame web Project start depends on , Automatically associate other dependencies through this dependency , We don't need to add one by one -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--SpringBoot The testing of the framework depends on , for example :junit test , If you don't need it, you can delete -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- Build : compile -->
<build>
<!-- Which resource to compile -->
<resources></resources>
<!-- plug-in unit -->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.7.0</version>
</plugin>
</plugins>
</build>
</project>
10. Run input localhost:9001/001-springboot-first/springBoot/say According to successful


11. Introduction case summary and analysis
Spring Boot Our father depends on spring-boot-starter-parent After configuration , The current project is Spring Boot project
spring-boot-starter-parent It's a Springboot Our father depends on , Development SpringBoot All programs need to inherit the parent project , It is used to provide relevant Maven Default dependency , After using it , frequently-used jar Package dependency can eliminate version To configure
Spring Boot What defaults are available jar Package dependency , You can view the pom file
If you do not want to use a default dependent version , Can pass pom.xml The attribute configuration of the file overrides each dependency , Like coverage Spring edition
<properties>
<spring.version>5.0.0.RELEASE</spring.version>
</properties>
@SpringBootApplication The note is Spring Boot The core notes of the project , The main function is to turn on Spring Automatic configuration , If in Application Class , Then it won't start SpringBoot Program
main The method is a standard Java programmatic main Method , The main function is to serve as the entrance for the project startup and operation
@Controller And @ResponseBody It's still what we were before Spring MVC, because Spring Boot It still uses our Spring MVC + Spring + MyBatis Other framework
边栏推荐
- Second IPO of Huafang group: grown up in Zanthoxylum bungeanum, trapped in Zanthoxylum bungeanum
- 结合源码剖析Oauth2分布式认证与授权的实现流程
- 非单文件组件
- The difference between interceptor and filter
- 剑指 Offer 13. 机器人的运动范围
- laravel 验证器的使用
- vulnhub DC: 2
- Based on the codeless platform, users deeply participated in the construction, and digital data + Nanjing Fiberglass Institute jointly built a national smart laboratory solution
- 「ARM 架构」是一种怎样的处理器架构?
- Research Report on market supply and demand and strategy of China's solar charging controller industry
猜你喜欢

How to submit the shopee opening and settlement flow?

Parental delegation mechanism

JD 618 conference tablet ranking list announced that the new dark horse brand staff will compete for the top three, learning from Huawei, the leader of domestic products

研究生宿舍大盘点!令人羡慕的研究生宿舍来了!

别再乱用了,这才是 @Validated 和 @Valid 的真正区别!!!

2022年高压电工考试模拟100题及在线模拟考试

The large-scale market of graduate dormitory! Here comes the enviable graduate dormitory!

大厂面试必问:如何解决TCP可靠传输问题?8张图带你详细学习

Learning bit segment (1)

加分利器 不负所托 | 知道创宇获攻防演练防守方感谢信!
随机推荐
Uip1.0 active sending problem understanding
【Mongodb】READ_ME_TO_RECOVER_YOUR_DATA,数据库被恶意删除
「ARM 架构」是一种怎样的处理器架构?
Recommended course: workplace writing training
Leetcode algorithm refers to offer II 027 Palindrome linked list
【文本数据挖掘】中文命名实体识别:HMM模型+BiLSTM_CRF模型(Pytorch)【调研与实验分析】
剑指 Offer 13. 机器人的运动范围
Non single file component
The difference between interceptor and filter
[ROS play with turtle turtle]
Beijiafu (p+f) R2000 modified radar IP
laravel 定时任务
laravel 添加helper文件
上新了,华为云开天aPaaS
See how sparksql supports enterprise data warehouse
是否需要提高代码阅读能力?这有技巧
[laravel series 7.9] test
vulnhub Vegeta: 1
Annotation
Solution to the login error of tangdou people

