背景
我們的系統基本都是前后端分離架構,后端服務主要框架是基於java的spring boot,為了快速的構建新項目,將平時做后端的東西抽出一個開發腳手架。
技術棧
- java 8
- spring-boot 2.2.7.RELEASE
- swagger 2.9.2
- guava 29.0-jre
- mybait.spring 1.3.2
- HikariCP 3.2.0
- xxl-job 2.1.0
- lombok 1.18.0
- Jedis 3.2.0
- Elasticsearch 7
- zookeeper client 4.3.0
項目
名稱:spring-boot-seed
seed-client:常用的組件client
seed-common:通用類和util
seed-task:集成xxl-job做定時任務
seed-web:web后端服務,數據庫mysql,使用spring mybatis操作數據庫
地址:https://github.com/luxiaoxun/spring-boot-seed
小記錄:
Springboot中bean的“構造”和“析構”順序:
1. Bean instance is created
2. Bean properties are set
3. In case bean implements Aware interfaces - those implemented methods are invoked
4. BeanPostProcessor#postProcessBeforeInitialization methods of custom bean post-processors are invoked
5. Initialization callbacks are invoked in the following order:
- 5.1. @PostConstruct method is invoked
- 5.2. InitializingBean#afterPropertiesSet() method is invoked
- 5.3. @Bean#initMethod() method is invoked
Bean is fully initialized now.
6. BeanPostProcessor#postProcessAfterInitialization methods of custom post-processors are invoked
7. Destruction callbacks are invoked in the following order:
- 7.1. @PreDestroy method is invoked
- 7.2. DisposableBean#destroy() method is invoked
- 7.3. @Bean#destroyMethod method is invoked