当前位置:网站首页>基础篇——基础项目解析
基础篇——基础项目解析
2022-07-05 10:46:00 【printf('小白');】
- SpringBoot优点
- 起步依赖 (简化依赖程序)
自动配置 (简化工程相关配置)
辅助功能(内置服务器, …)
- 起步依赖 (简化依赖程序)
parent
spring-boot-dependencies-2.6.1.pom中定义了很多个版本和坐标关系
- 阿里云创建版本直接引用了
spring-boot-dependencies
(继承只能用一次) 避免多个依赖使用相同的技术时出现版本冲突
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
可以只写GA不用写V
- 遇到错误之后再加入V版本信息,但是要
小心版本冲突
starter
- 一个starter提供了一个技术所需的各种依赖,达到
减少依赖配置的目的
- 简化配置的目的
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
引导类
- 引导类是Boot工程的执行入口,运行main方法就可以启动项目
- SpringBoot工程运行后初始化Spring容器,扫描引导类所在包加载Bean
@SpringBootApplication
public class Springboot0101QuickstartApplication {
public static void main(String[] args) {
ConfigurableApplicationContext run = SpringApplication.run(Springboot0101QuickstartApplication.class, args);
BookController bean = run.getBean(BookController.class);
System.out.println("book--==>"+ bean);
User bean1 = run.getBean(User.class);
System.out.println("User--==>"+ bean1);
}
}
内嵌tomcat
- SpringBoot内置一个tomcat服务器
- 可以从starter-web中排除换成其他的服务器,例如下面案例中的
jetty
- 常见的内置服务器
- apache出品,粉丝多,
应用面广
,负载了若干较重的组件
jetty更轻量级
,负载性能远不及tomcat
undertow 负载性能勉强跑赢tomcat
- apache出品,粉丝多,
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
边栏推荐
- Wechat nucleic acid detection appointment applet system graduation design completion (6) opening defense ppt
- 2022年危险化学品生产单位安全生产管理人员特种作业证考试题库模拟考试平台操作
- LSTM applied to MNIST dataset classification (compared with CNN)
- Variables///
- Go语言-1-开发环境配置
- 磨礪·聚變|知道創宇移動端官網煥新上線,開啟數字安全之旅!
- Go project practice - Gorm format time field
- Use bat command to launch common browsers with one click
- How to close the log window in vray5.2
- 函数///
猜你喜欢
csdn软件测试入门的测试基本流程
一次edu证书站的挖掘
2022鹏城杯web
Go language learning notes - first acquaintance with go language
磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!
基于昇腾AI丨爱笔智能推出银行网点数字化解决方案,实现从总部到网点的信息数字化全覆盖
Wechat nucleic acid detection appointment applet system graduation design completion (7) Interim inspection report
【JS】提取字符串中的分数,汇总后算出平均分,并与每个分数比较,输出
Based on shengteng AI Yisa technology, it launched a full target structured solution for video images, reaching the industry-leading level
不要再说微服务可以解决一切问题了!
随机推荐
2022鹏城杯web
2022 mobile crane driver examination question bank and simulation examination
Data type
iframe
Honing · fusion | know that the official website of Chuangyu mobile terminal is newly launched, and start the journey of digital security!
About the use of Vray 5.2 (self research notes)
MFC宠物商店信息管理系统
regular expression
Operators
Some understandings of heterogeneous graphs in DGL and the usage of heterogeneous graph convolution heterographconv
微信核酸检测预约小程序系统毕业设计毕设(8)毕业设计论文模板
变量///
流程控制、
SQL Server monitoring statistics blocking script information
数据类型、
matlab cov函数详解
Solution to the length of flex4 and Flex3 combox drop-down box
Implement the rising edge in C #, and simulate the PLC environment to verify the difference between if statement using the rising edge and not using the rising edge
websocket
2021年山东省赛题库题目抓包