当前位置:网站首页>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
边栏推荐
- Development specification - parameter verification exception, exception return prompt section
- [ROS play with turtle turtle]
- 上新了,华为云开天aPaaS
- 关于某手滑块的一些更新(6-18,js逆向)
- 推送Markdown格式信息到钉钉机器人
- 【WSL】SSH 远程连接及宿主机端口转发配置
- 动态菜单,自动对齐
- EPICS記錄參考3 -- 所有記錄都有的字段
- [laravel series 7.9] test
- Learn more about redis' eight data types and application scenario analysis
猜你喜欢

Win10 or win11 printer cannot print

Environment configuration | vs2017 configuring openmesh source code and environment

Canvas to add watermark to pictures

Getting started with the go Cobra command line tool

EPICS记录参考4--所有输入记录都有的字段和所有输出记录都有的字段

Talk about GC mechanism often asked in interview

关于某手滑块的一些更新(6-18,js逆向)

京东618会议平板排行榜公布,新锐黑马品牌会参谋角逐前三名,向国货老大华为学习

对抗训练理论分析:自适应步长快速对抗训练

糖豆人登录报错解决方案
随机推荐
动态菜单,自动对齐
02_SpingBoot 入门案例
EPICS记录参考4--所有输入记录都有的字段和所有输出记录都有的字段
AttacKG: Constructing Technique Knowledge Graph from Cyber Threat Intelligence Reports代码复现
别再乱用了,这才是 @Validated 和 @Valid 的真正区别!!!
Solve the problem of non secure websites requesting localhost to report CORS after chrome94
2022-06-10 work record --js- obtain the date n days after a certain date
Market trend report, technical innovation and market forecast of solar roof system in China
ThreadLocal local thread
A big factory interview must ask: how to solve the problem of TCP reliable transmission? 8 pictures for you to learn in detail
【文本数据挖掘】中文命名实体识别:HMM模型+BiLSTM_CRF模型(Pytorch)【调研与实验分析】
07_SpingBoot 实现 RESTful 风格
go Cobra命令行工具入门
[postgraduate entrance examination English] prepare for 2023, learn list8 words
laravel学习笔记
Canvas to add watermark to pictures
加分利器 不负所托 | 知道创宇获攻防演练防守方感谢信!
Recommended course: workplace writing training
上新了,华为云开天aPaaS
23研考生注意啦!备考期间最容易中招的骗局,居然是它们?!

