Home / Function/ prepareEnvironment() — spring-boot Function Reference

prepareEnvironment() — spring-boot Function Reference

Architecture documentation for the prepareEnvironment() function in SpringApplication.java from the spring-boot codebase.

Function java GradlePlugin RunTasks calls 7 called by 1

Entity Profile

Dependency Diagram

graph TD
  be6f5284_4891_57c6_72a4_fd3fc0c8c35a["prepareEnvironment()"]
  89cfa04a_3922_680e_945d_5b4338252cc7["run()"]
  89cfa04a_3922_680e_945d_5b4338252cc7 -->|calls| be6f5284_4891_57c6_72a4_fd3fc0c8c35a
  14e6b4ac_b1d6_2da9_62c4_f1bee3300f0b["getOrCreateEnvironment()"]
  be6f5284_4891_57c6_72a4_fd3fc0c8c35a -->|calls| 14e6b4ac_b1d6_2da9_62c4_f1bee3300f0b
  7454fd0c_15bf_c5e0_c269_c1fe65124b65["configureEnvironment()"]
  be6f5284_4891_57c6_72a4_fd3fc0c8c35a -->|calls| 7454fd0c_15bf_c5e0_c269_c1fe65124b65
  660de5d2_3b68_dc8d_57eb_76ad92696657["attach()"]
  be6f5284_4891_57c6_72a4_fd3fc0c8c35a -->|calls| 660de5d2_3b68_dc8d_57eb_76ad92696657
  19e84647_774d_f8e2_34b3_754d1d840e88["moveToEnd()"]
  be6f5284_4891_57c6_72a4_fd3fc0c8c35a -->|calls| 19e84647_774d_f8e2_34b3_754d1d840e88
  39ef021c_ae99_f6d7_d1c9_3905f466f9b5["bindToSpringApplication()"]
  be6f5284_4891_57c6_72a4_fd3fc0c8c35a -->|calls| 39ef021c_ae99_f6d7_d1c9_3905f466f9b5
  be22d695_81d3_ca24_90d4_9385a402a390["getClassLoader()"]
  be6f5284_4891_57c6_72a4_fd3fc0c8c35a -->|calls| be22d695_81d3_ca24_90d4_9385a402a390
  e327cbe2_6e75_bc0a_2431_c512b58fc8bf["deduceEnvironmentClass()"]
  be6f5284_4891_57c6_72a4_fd3fc0c8c35a -->|calls| e327cbe2_6e75_bc0a_2431_c512b58fc8bf
  style be6f5284_4891_57c6_72a4_fd3fc0c8c35a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

core/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java lines 350–368

	private ConfigurableEnvironment prepareEnvironment(SpringApplicationRunListeners listeners,
			DefaultBootstrapContext bootstrapContext, ApplicationArguments applicationArguments) {
		// Create and configure the environment
		ConfigurableEnvironment environment = getOrCreateEnvironment();
		configureEnvironment(environment, applicationArguments.getSourceArgs());
		ConfigurationPropertySources.attach(environment);
		listeners.environmentPrepared(bootstrapContext, environment);
		ApplicationInfoPropertySource.moveToEnd(environment);
		DefaultPropertiesPropertySource.moveToEnd(environment);
		Assert.state(!environment.containsProperty("spring.main.environment-prefix"),
				"Environment prefix cannot be set via properties.");
		bindToSpringApplication(environment);
		if (!this.isCustomEnvironment) {
			EnvironmentConverter environmentConverter = new EnvironmentConverter(getClassLoader());
			environment = environmentConverter.convertEnvironmentIfNecessary(environment, deduceEnvironmentClass());
		}
		ConfigurationPropertySources.attach(environment);
		return environment;
	}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does prepareEnvironment() do?
prepareEnvironment() is a function in the spring-boot codebase.
What does prepareEnvironment() call?
prepareEnvironment() calls 7 function(s): attach, bindToSpringApplication, configureEnvironment, deduceEnvironmentClass, getClassLoader, getOrCreateEnvironment, moveToEnd.
What calls prepareEnvironment()?
prepareEnvironment() is called by 1 function(s): run.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free