# thinking-in-spring-boot **Repository Path**: lstarby/thinking-in-spring-boot ## Basic Information - **Project Name**: thinking-in-spring-boot - **Description**: 《Spring Boot编程思想(核心篇)》学习过程中的代码记录 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2024-04-23 - **Last Updated**: 2024-04-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 《Spring Boot编程思想(核心篇)》学习笔记 > 工程代码均是基于 Spring Boot 2.1.6.RELEASE 进行实现 # 第2章 SpringBoot应用打包方式和启动加载过程 - **spring-boot-launcher** 解析SpringBoot启动加载的过程 # 第3章 不同Maven依赖管理的对比 - **spring-boot-launcher** 原有继承parent的形式实现 - **spring-boot-dependency** import导入spring-boot-dependencies的做法 # 第4章 切换嵌入式Web容器 - **spring-boot-launcher** 通过修改pom文件,完成不同WebServer容器的替换 Servlet:默认实现Tomcat | 容器 | WebServer实现类 | | --- | --- | | **Tomcat** | **TomcatWebServer** | | Jetty | JettyWebServer | | Undertow | UndertowServletWebServer | Reactive:默认实现Netty | 容器 | WebServer实现类 | | --- | --- | | **Netty** | **NettyWebServer** | | Tomcat | TomcatWebServer | | Jetty | JettyWebServer | | Undertow | UndertowWebServer | Servlet和Reactive共存的问题: - Tomcat、Jetty、Undertow这些支持Servlet的容器,内部是有相应的Servlet类 - Netty中,默认不提供javax.servlet实现,需要另行引入servlet包 - 不过问题来了,都使用Netty了,一般是用不到Servlet的,但如果有用到的话可参照此处笔记 # 第5章 理解自动装配 - **spring-boot-configuration** 几种自动装配的实现验证 @SpringBootApplication = @Configuration + @EnableAutoConfiguration + @ComponentScan **Spring模式注解:** 当A注解上加了B注解后,注解A的地方,相当于同时注解了B ``` @Component |-@Configuration |-@SpringBootConfiguration ``` @AliasFor 注解可以使得“派生”注解的属性作为“被派生”注解的属性而存在,eg.@SpringBootApplication.scanBasePackages @SpringBootApplication注解可标记在非引导类上 @Configuration标记的类,会使用CGLib加载,以提升性能 可通过META-INF/spring.factories形式,进行自动装配