• springBoot启动加载笔记


    1.在启动类上增加注解@SpringBootApplication和在main方法里面调用SpringApplication的静态方法run

    我们开发任何一个Spring Boot项目,都会用到如下的启动类

    复制代码
    @SpringBootApplication
    public class Application {
        public static void main(String[] args) {
            SpringApplication.run(Application.class, args);
        }
    }
    复制代码

    从上面代码可以看出,Annotation定义(@SpringBootApplication)和类定义(SpringApplication.run)最为耀眼,所以要揭开SpringBoot的神秘面纱,我们要从这两位开始就可以了。

    2.在@SpringBootApplication注解源码可以看到包含了哪些注解,主要是三个SpringBootConfiguration,EnableAutoConfiguration, ComponentScan

    SpringBootApplication背后的秘密

    复制代码
    @Target(ElementType.TYPE)            // 注解的适用范围,其中TYPE用于描述类、接口(包括包注解类型)或enum声明
    @Retention(RetentionPolicy.RUNTIME)  // 注解的生命周期,保留到class文件中(三个生命周期)
    @Documented                          // 表明这个注解应该被javadoc记录
    @Inherited                           // 子类可以继承该注解
    @SpringBootConfiguration             // 继承了Configuration,表示当前是注解类
    @EnableAutoConfiguration             // 开启springboot的注解功能,springboot的四大神器之一,其借助@import的帮助
    @ComponentScan(excludeFilters = {    // 扫描路径设置(具体使用待确认)
            @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class),
            @Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class) })
    public @interface SpringBootApplication {
    ...
    }

    3.
  • 相关阅读:
    jsp 说明标签
    atcoder 它February 29th
    centos编译内核:no space left on device 解
    《Javascript权威指南》十六学习笔记:BOM资源---BOM基本应用
    2014ACM/ICPC亚洲区域赛牡丹江站汇总
    Swift_3_功能
    ExtJs在disabled和readOnly美学分析
    android -- 蓝牙 bluetooth (四)OPP文件传输
    android -- 蓝牙 bluetooth (三)搜索蓝牙
    android -- 蓝牙 bluetooth (二) 打开蓝牙
  • 原文地址:https://www.cnblogs.com/handsome1013/p/11078612.html
Copyright © 2020-2023  润新知