Spring Boot 啟動時有以下幾個接口:
1. `CommandLineRunner`:用于在應用程序啟動后執行一些任務。
2. `ApplicationRunner`:與 `CommandLineRunner` 類似,也是在應用程序啟動后執行一些任務的接口,不同之處在于它可以接受一個 `ApplicationArguments` 對象作為參數,可以更方便地獲取命令行參數。
3. `SmartLifecycle`:用于控制應用程序的生命周期,在應用程序啟動和關閉時執行一些操作,例如初始化和清理資源等。
4. `EmbeddedServletContainerCustomizer`:用于自定義嵌入式 Servlet 容器的配置,例如修改端口、上下文路徑等。
5. `ServletContextInitializer`:用于初始化 Servlet 上下文,例如注冊 Servlet、Filter、Listener 等。
6. `WebMvcConfigurer`:用于配置 Spring MVC 的相關屬性,例如消息轉換器、攔截器等。
這些接口都是 Spring Boot 中的常用接口,通過實現它們可以幫助我們更好地控制應用程序的啟動和運行。我們可以根據具體的需求來選擇實現其中的某些接口,并重寫其中的方法以達到想要的效果。
- 環境配置
- window怎么配置java環境變量?
- Java基礎語法
- Java中的數據類型
- Java中的JSONObject
- Java高級特性
- Maven
- jib-maven-plugin
- 什么是Spring Boot 的 parent pom?
- maven中各個生命周期的含義
- Spring Boot
- maven與spring boot 的關系
- 配置文件
- application-properties配置文件
- Spring Boot 的啟動
- spring boot項目如何啟動?
- 列舉一下Spring Boot的啟動過程
- SpringApplication.run方法
- Spring Boot 啟動時有哪些接口?
- CommandLineRunner
- Spring Boot 的常用注解
- 系統注解
- 表格:系統注解
- @Override
- @Deprecated
- @SuppressWarnnings
- 使用在類名上的注解
- 表格:使用在類名上的注解
- @RestController
- @Controller
- @Service
- @Repository
- @Component
- @Configuration
- @Resource
- @Autowired
- @RequestMapping
- @PostMapping
- @GetMapping
- @Transactional
- @Qualifier
- 使用在方法上的注解
- 表格:使用在方法上的注解
- @RequestBody
- @PathVariable
- @Bean
- @ResponseBody
- @PreAuthorize
- 其他常用注解
- 表格:其他常用注解
- @EnableAutoConfiguration
- @SpringBootApplication
- @EnableScheduling
- @EnableAsync
- @ComponentScan
- @Aspec
- @ControllerAdvice
- @ExceptionHandler
- @Value
- @ConfigurationProperties
- @EnableConfigurationProperties
- @MapperScan
- Validator驗證的常用注解
- spring IoC容器
- Spring IoC容器依賴注入實現方式
- MyBatis
- paginationInterceptor
- @TableName
- @TableId
- @Param
- UrlBasedCorsConfigurationSource
- Lombok
- @Data
- @Slf4j
- @EqualsAndHashCode
- @Accessors
- 支付系統
- 1. 初始化mysql數據庫流程
- 2. 初始化redis數據庫的流程
- 3. 初始化rabbitmq服務