-
Notifications
You must be signed in to change notification settings - Fork 20
SpringBoot2
kcp edited this page Jul 13, 2020
·
2 revisions
目录 start
目录 end|2020-04-27 23:42|
变化比较大 官方说明对比1所更改的文档
spring boot 2.0 半月的实战_阶段性总结1 SpringBoot2.0 jpa多数据源配置 Springboot2.0 升级(Gradle工程) 使用精简版jdk9在docker上运行springboot2 Spring Boot 2.0系列文章(一):Spring Boot 2.0 迁移指南
Spring Boot 2.0系列文章(二):Spring Boot 2.0 新特性详解 参考: Spring Boot 2.0 新特性和发展方向
org.springframework.boot:spring-boot-starter-web 依赖中默认包含了Tomcat
SpringBoot2的跨域配置 最终是采用的Nginx进行反向代理,将后台服务放在前台服务子路径下
- 直接看 源码中
ApplicationContextEvent
类的 继承结构, 就能发现 有四个子类- ContextCloseEvent
- ContextRefreshEvent
- ContextStopEvent
- ContextStartEvent
在任意的Component中添加如下类似的方法就能监听到如上事件
@EventListener
public void handleContextClosedEvent(ContextClosedEvent event) {
// todo
}
@Configuration
public class Listener implements ApplicationListener {
@Override
public void onApplicationEvent(ApplicationEvent event) {
// 在这里可以监听到Spring Boot的生命周期
if (event instanceof ContextRefreshedEvent) {
System.out.println("应用刷新");
}
if (event instanceof ContextStartedEvent) {
System.out.println("应用启动");
} else if (event instanceof ContextStoppedEvent) {
System.out.println("应用停止");
} else if (event instanceof ContextClosedEvent) {
System.out.println("应用关闭");
}
}
}
- 但是只有应用刷新, 应用启动完成, 应用关闭是能够正常监听到的
-
【 Algorithm 】
-
【 Blog 】
-
【 C 】
-
【 Database 】
-
【 Distributed 】
-
【 FrontEnd 】
- 【 FrontEnd/Frame 】
- 【 FrontEnd/Node 】
- Font
- Hexo
- JavaScript
- LearnPS
- ResponseCode
- SVG
- ViewSolution
- extjs学习笔记
-
【 Functional 】
-
【 Go 】
-
【 Groovy 】
-
【 Java 】
- 【 Java/AdvancedLearning 】
- 【 JavaBasic 】
- 【 JavaCache 】
- 【 JavaCollection 】
- 【 JavaConcurrency 】
- 【 JavaMap 】
- Annotation
- ClassFile
- Collection
- Concurrency
- Deploy
- Exception
- ExtendsAndInterface
- Generics
- IO
- JDBC
- JDKAndJRE
- JMX
- JVM
- Java11
- Java7
- Java8
- JavaNetwork
- JavaReleaseVersion
- JavaWeb
- JvmPerformance
- MQ
- MultipleLanguage
- Proxy
- Reflection
- Serialize
- SyntaxAndType
- Thread
- WebPerformance
- 【 Java/Android 】
- 【 Java/Ecosystem 】
- 【 Java/MSA 】
- 【 Java/Spring 】
- 【 Java/TemplateEngine 】
- 【 Java/Test 】
- 【 Java/Tool 】
- 【 Java/thread 】
- AlibabaJavaStandard
- DesignPattern
- HashMap解析
- Java-NIO
- Java虚拟机
- Log
- MIS
- Quartz
- RESTful
- WebSocket学习笔记
- ZooKeeper学习笔记
- android学习笔记
- 【 Java/AdvancedLearning 】
-
【 Kotlin 】
-
【 Linux 】
- 【 Linux/Alpine 】
- 【 Linux/Arch 】
- 【 Linux/Base 】
- 【 Linux/Centos 】
- 【 Linux/Container 】
- 【 Linux/Debian 】
- 【 Linux/Tool 】
- JavaDevInit
- Linux系统学习
-
【 MyBlog 】
-
【 Python 】
- 【 Python/Tool 】
- Python
- PythonConcurrent
- PythonGUI
- PythonGame
- PythonNet
- PythonOffices
- PythonWeb
- Python基础
- Python核心学习
-
【 Reactive 】
-
【 Rust 】
-
【 Scala 】
-
【 Script 】
-
【 Skills 】
- 【 Skills/Application 】
- 【 Skills/CS 】
- 【 Skills/Cache 】
- 【 Skills/Councurrency 】
- 【 Skills/DevOps 】
- 【 Skills/Document 】
- 【 Skills/Ecology 】
- 【 Skills/Network 】
- 【 Skills/Search 】
- 【 Skills/SoftwareEngineering 】
- 【 Skills/Spider 】
- 【 Skills/Test 】
- 【 Skills/Vcs 】
- 【 Skills/Work 】
- AppManual
- CelebrityQuotes
- Miscellaneous
- Platform
- Problem
- Protobuf
- RegularExpression
- SoftwareDesignEngineer
- Website
-
【 Windows 】