当前位置:网站首页>基础篇——基础项目解析
基础篇——基础项目解析
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>
边栏推荐
- 2022鹏城杯web
- NAS and San
- 9、 Disk management
- 【广告系统】Parameter Server分布式训练
- Repair animation 1K to 8K
- 上拉加载原理
- Broyage · fusion | savoir que le site officiel de chuangyu mobile end est en ligne et commencer le voyage de sécurité numérique!
- Solution to the length of flex4 and Flex3 combox drop-down box
- Based on shengteng AI Yisa technology, it launched a full target structured solution for video images, reaching the industry-leading level
- Go project practice - Gorm format time field
猜你喜欢

Wechat nucleic acid detection appointment applet system graduation design completion (6) opening defense ppt

Lombok 同时使⽤@Data和@Builder 的坑,你中招没?

【广告系统】增量训练 & 特征准入/特征淘汰

LSTM applied to MNIST dataset classification (compared with CNN)

2022 Pengcheng cup Web

关于vray5.2怎么关闭日志窗口

Bidirectional RNN and stacked bidirectional RNN

Based on shengteng AI Yisa technology, it launched a full target structured solution for video images, reaching the industry-leading level

微信核酸检测预约小程序系统毕业设计毕设(8)毕业设计论文模板

Some understandings of heterogeneous graphs in DGL and the usage of heterogeneous graph convolution heterographconv
随机推荐
Solution to the length of flex4 and Flex3 combox drop-down box
MFC宠物商店信息管理系统
Nine degrees 1480: maximum ascending subsequence sum (dynamic programming idea for the maximum value)
【Oracle】使用DataGrip连接Oracle数据库
四部门:从即日起至10月底开展燃气安全“百日行动”
uniapp
正则表达式
【tcp】服务器上tcp连接状态json形式输出
Go language learning notes - first acquaintance with go language
vite//
SQL Server monitoring statistics blocking script information
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
2022 Pengcheng cup Web
DOM//
中职组网络安全2021年江苏省省赛题目5套题目环境+解析全有需要的私信我
Data type
DGL中异构图的一些理解以及异构图卷积HeteroGraphConv的用法
Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework
Lazy loading scheme of pictures
Bracket matching problem (STL)