基于springboot的后端服务开发脚手架
背景
我们的系统基本都是前后端分离架构,后端服务主要框架是基于java的spring boot,为了快速的构建新项目,将平时做后端的东西抽出一个开发脚手架。
技术栈
- java 21
- spring-boot 3.2.1
- springdoc-openapi 2.3.0
- guava 32
- mybatis.spring 3.0.3
- mysql 8
- HikariCP 3.4.5
- xxl-job 2.1.0
- lombok 1.18.30
- Elasticsearch 7
- redisson 3.23.2
- sa-token 1.37.0
项目名称:spring-boot-seed
-
seed-common:通用Util
-
seed-engine:基于kafka和disruptor的数据处理服务
-
seed-task:集成xxl-job做定时任务
-
seed-web:web后端服务,数据库mysql,用spring mybatis操作数据库
地址:
Gitee:https://gitee.com/luxiaoxun001/spring-boot-seed
GitHub: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