environment是在printBanner之前就初始化好了, 更在context创建之前,

已经加载application-xxxx.properties, System.properties, System.environment ...

也可以自己监听应用启动 SpringApplicationRunListener事件, 完成自己的独特的配置加载方案

启动后调用listener.finished() 打印一些启动后的信息

prepareEnvironment()源码如下
     private ConfigurableEnvironment prepareEnvironment(
SpringApplicationRunListeners listeners,
ApplicationArguments applicationArguments) {
// Create and configure the environment
ConfigurableEnvironment environment = getOrCreateEnvironment(); //加载标准目录下的配置文件 &profile
configureEnvironment(environment, applicationArguments.getSourceArgs());
//加载自定义的配置方案
listeners.environmentPrepared(environment);
if (!this.webEnvironment) {
environment = new EnvironmentConverter(getClassLoader())
.convertToStandardEnvironmentIfNecessary(environment);
}
return environment;
}

@ConfigurationProperties  使用的变量也是从environment中取的

CLI参数配置方式:

参考:

https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-relaxed-binding

https://www.baeldung.com/properties-with-spring

environment与@ConfigurationProperties的关系 加载过程分析的更多相关文章

  1. 转:A10/A20 Bootloader加载过程分析

    来自:http://blog.csdn.net/allen6268198/article/details/12905425 A10/A20 Bootloader加载过程分析 注:由于全志A10和A20 ...

  2. 【转】全志A10/A20 Bootloader加载过程分析

    原文 : http://blog.csdn.net/allen6268198/article/details/12905425 从这里开始:http://linux-sunxi.org/Bootabl ...

  3. seaJS 模块加载过程分析

    先看一个seajs的官方example,  以下以seajs.use('main')为例, 解析加载mod main的过程 //app.html seajs.use("main") ...

  4. Insmod模块加载过程分析

    一.背景 a) 在进行JZ2440的一个小demo开发的时候,使用自己编译的内核(3.4.2)及lcd模块进行加载时,insmod会提示加载失败因为内核版本不匹配(提示当前内核版本为空),并且显示模块 ...

  5. nib 加载过程分析以及对File’s Owner的理解

    nib loading的过程,这个是app文档里面有说到资源编程指南 1.  It loads the contents of the nib file and any referenced reso ...

  6. Spring Boot 启动(二) Environment 加载

    Spring Boot 启动(二) Environment 加载 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) 上一节中 ...

  7. Android HotFix动态加载框架介绍

    HotFix(Deprecated) https://github.com/dodola/HotFix 请关注 RocooFix 我重新写了一个RocooFix框架,解决了Nuwa因为Gradle1. ...

  8. Dubbo 扩展点加载机制:从 Java SPI 到 Dubbo SPI

    SPI 全称为 Service Provider Interface,是一种服务发现机制.当程序运行调用接口时,会根据配置文件或默认规则信息加载对应的实现类.所以在程序中并没有直接指定使用接口的哪个实 ...

  9. 从阿里巴巴笔试题看Java加载顺序

    一.阿里巴巴笔试题: public class T implements Cloneable { public static int k = 0; public static T t1 = new T ...

随机推荐

  1. Windows系统 安装 CMake

    Windows系统 安装 CMake 我们的电脑系统:Windows 10 64位 安装的CMake 版本:cmake-3.6.1-win64-x64(目前最新) 下载 在CMake官网下载:cmak ...

  2. wpf 窗口打开后默认设置控件焦点

    https://blog.csdn.net/Vblegend_2013/article/details/81771872 <Grid FocusManager.FocusedElement=&q ...

  3. JavaPersistenceWithMyBatis3笔记-第2章Bootstrapping MyBatis-001XMl形式和Java形式

    一. 1.Mapper 同上 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper ...

  4. linux文件夹删除、创建

    一.删除文件夹 rm -rf ./html2imag 二.创建文件夹 mkdir html2image

  5. c++线程调用python

    c++调用python,底层就似乎fork一个子进程启动一个python的解释器,执行python文件,由于python解释器维护了一个内部状态,所以如果c++程序是多线程,每个线程都调用python ...

  6. android listview addHeaderView和addFooterView的注意事项

    1. item内如果有button等控件时,在监听listview的onitemclick事件时,焦点会被item内的button. imagebutton等控件抢走,从而导致在listview设置了 ...

  7. 存储类型auto,static,extern,register的区别 <转>

    变量和函数的属性包括数据类型和数据的存储类别,存储类别指数据在内存中存储方式(静态和动态),包含auto,static,register,extern四种. 内存中.具体点来说内存分为三块:静态区,堆 ...

  8. android 6.0(23)的权限管理

    前言 谷歌在2015年8月份时候,发布了Android 6.0版本,代号叫做“棉花糖”(Marshmallow ),其中的很大的一部分变化,是在用户权限授权上,或许是感觉之前默认授权的不合理,现在6. ...

  9. C#修饰符讲解大全

    1.修饰符是什么? 修饰符是用于限定类型以及类型成员的声明的一种符号.[百度百科] 2.修饰符分类 13种修饰符,按功能可分为三类:访问修饰符,类修饰符和成员修饰符.[百度百科] 作 用:限定类型以及 ...

  10. Flink on Yarn模式启动流程分析

    此文已由作者岳猛授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. Flink On Yarn 架构 Paste_Image.png 前提条件首先需要配置YARN_CONF_DI ...