一些bean的定制
生命周期回调,Lifecycle Callback.
XxxAware接口,例如,BeanFactorAware
maven管理小技巧
了解依赖
- mvn dependency:tree
- IDEA Maven Helper
统一依赖管理
- dependencyManagement,版本号与exclusion。
springboot 自定义starter
命名方式:Xxx-spring-boot-starter.不要使用spring-boot作为前缀,防止重复。
声明对spring-boot-starter
的依赖
starter
中仅包含必要的依赖
springboot的**外部配置加载顺序**。
springboot属性绑定:@ConfigurationProperties
SpringBoot的四大核心
- Auto Configuration,原理:@EnableAutoConfiguration+条件装配
@Conditional
,自动装配顺序可以调整,例如,@AutoConfigureBefore
- 起步依赖,Starter Dependency
- 命令行工具,Spring Boot CLI
- Actuator