springboot源码解析(三)prepareEnvironment(listeners, applicationArguments);

本文详细解析了SpringApplication在启动过程中`prepareEnvironment`方法的执行流程,包括环境配置、属性源定制、环境准备监听器的触发,探讨了如何影响SpringBoot应用的初始化过程。
摘要由CSDN通过智能技术生成

在SpringApplication的启动的run方法中,有这么一个方法:

ConfigurableEnvironment environment = prepareEnvironment(listeners,
					applicationArguments);

此方法是准备运行时的环境。这段代码的具体实现如下:

	private ConfigurableEnvironment prepareEnvironment(
			SpringApplicationRunListeners listeners,
			ApplicationArguments applicationArguments) {
		// Create and configure the environment
		ConfigurableEnvironment environment = getOrCreateEnvironment();
		configureEnvironment(environment, applicationArguments.getSourceArgs());
		listeners.environmentPrepared(environment);
		if (!this.webEnvironment) {
			environment = new EnvironmentConverter(getClassLoader())
					.convertToStandard
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值