美文网首页
SpringBoot 分析

SpringBoot 分析

作者: 幻影翔 | 来源:发表于2020-02-14 14:35 被阅读0次
image.png
image.png

DispatchServlet的功能

  • 捕获特定格式的Url请求
  • 初始化DispatchServlet的上下问,处理相关逻辑
  • 初始化Spring MVC的各个组成部件,装配到DispatchServlet中


    image.png

@SpringBootApplication注解

有以下三个注解组成

  • @Configuration
  • @EnableAutoConfiguration
  • @ComponentScan 扫描包下@Component注解的类,并交由Spring 管理

@Configuration

image.png

SpingBoot 应用程序启动后执行的操作

默认情况下ApplicationRunner 执行优先于CommandLineRunner
@Order标识执行的顺序


ApplicationRunner
CommandLineRunner

Profiles配置文件

spring.profiles.active 使用那个配置


image.png

配置文件封装为实体类

application.yml配置文件 实体类

定时任务

  • @EnableScheduling 开启定时任务
  • @Scheduled 设置定时任务


    image.png
    image.png

相关文章

网友评论

      本文标题:SpringBoot 分析

      本文链接:https://www.haomeiwen.com/subject/xnbdfhtx.html