当前位置:网站首页>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
边栏推荐
- China solar thermal market trend report, technical dynamic innovation and market forecast
- 2022年高处安装、维护、拆除考试模拟100题及模拟考试
- Sword finger offer 42 Maximum sum of successive subarrays
- Tech Talk 活动回顾|云原生 DevOps 的 Kubernetes 技巧
- Uip1.0 active sending problem understanding
- 研究生宿舍大盘点!令人羡慕的研究生宿舍来了!
- EPICS记录参考4--所有输入记录都有的字段和所有输出记录都有的字段
- Leetcode algorithm refers to offer II 027 Palindrome linked list
- Non single file component
- EPICS record Reference 3 - - field available for all Records
猜你喜欢

机器学习编译入门课程学习笔记第一讲 机器学习编译概述

Second IPO of Huafang group: grown up in Zanthoxylum bungeanum, trapped in Zanthoxylum bungeanum

糖豆人登录报错解决方案

推送Markdown格式信息到钉钉机器人

Annotation

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

Memory alignment of structures

Spark 离线开发框架设计与实现

Epics record reference 4 -- fields for all input records and fields for all output records

EPICS记录参考2--EPICS过程数据库概念
随机推荐
剑指 Offer 42. 连续子数组的最大和
【ROS玩转Turtlesim小海龟】
研究生宿舍大盘点!令人羡慕的研究生宿舍来了!
docker安装mysql-简单无坑
laravel 宝塔安全配置
Research Report on market supply and demand and strategy of ceiling power supply device industry in China
Based on the codeless platform, users deeply participated in the construction, and digital data + Nanjing Fiberglass Institute jointly built a national smart laboratory solution
Research Report on market supply and demand and strategy of China's solar charging controller industry
China smallpox vaccine market trend report, technical innovation and market forecast
Non single file component
LeetCode Algorithm 剑指 Offer 52. 两个链表的第一个公共节点
Annotation
go Cobra命令行工具入门
The difference between get and post
How to submit the shopee opening and settlement flow?
推送Markdown格式信息到钉钉机器人
canvas 实现图片新增水印
Development specification - parameter verification exception, exception return prompt section
Some updates about a hand slider (6-18, JS reverse)
Research Report on solar battery charger industry - market status analysis and development prospect forecast

