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

onApplicationPreparedEvent() — spring-boot Function Reference

Architecture documentation for the onApplicationPreparedEvent() function in LoggingApplicationListener.java from the spring-boot codebase.

Function java GradlePlugin RunTasks calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  e389d288_71be_3902_7894_aac7043aa63c["onApplicationPreparedEvent()"]
  b564cced_f4c5_d5d5_9b54_9c77be901b07["onApplicationEvent()"]
  b564cced_f4c5_d5d5_9b54_9c77be901b07 -->|calls| e389d288_71be_3902_7894_aac7043aa63c
  a2fb37ac_574b_708c_d871_a8afdb97bd2f["getParent()"]
  e389d288_71be_3902_7894_aac7043aa63c -->|calls| a2fb37ac_574b_708c_d871_a8afdb97bd2f
  231ec461_2955_6224_c613_7eccfcde366f["getApplicationContext()"]
  e389d288_71be_3902_7894_aac7043aa63c -->|calls| 231ec461_2955_6224_c613_7eccfcde366f
  style e389d288_71be_3902_7894_aac7043aa63c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

core/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java lines 251–267

	private void onApplicationPreparedEvent(ApplicationPreparedEvent event) {
		ConfigurableApplicationContext applicationContext = event.getApplicationContext();
		ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
		if (!beanFactory.containsBean(LOGGING_SYSTEM_BEAN_NAME)) {
			Assert.state(this.loggingSystem != null, "loggingSystem is not set");
			beanFactory.registerSingleton(LOGGING_SYSTEM_BEAN_NAME, this.loggingSystem);
		}
		if (this.logFile != null && !beanFactory.containsBean(LOG_FILE_BEAN_NAME)) {
			beanFactory.registerSingleton(LOG_FILE_BEAN_NAME, this.logFile);
		}
		if (this.loggerGroups != null && !beanFactory.containsBean(LOGGER_GROUPS_BEAN_NAME)) {
			beanFactory.registerSingleton(LOGGER_GROUPS_BEAN_NAME, this.loggerGroups);
		}
		if (!beanFactory.containsBean(LOGGING_LIFECYCLE_BEAN_NAME) && applicationContext.getParent() == null) {
			beanFactory.registerSingleton(LOGGING_LIFECYCLE_BEAN_NAME, new Lifecycle());
		}
	}

Domain

Subdomains

Frequently Asked Questions

What does onApplicationPreparedEvent() do?
onApplicationPreparedEvent() is a function in the spring-boot codebase.
What does onApplicationPreparedEvent() call?
onApplicationPreparedEvent() calls 2 function(s): getApplicationContext, getParent.
What calls onApplicationPreparedEvent()?
onApplicationPreparedEvent() is called by 1 function(s): onApplicationEvent.

Analyze Your Own Codebase

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

Try Supermodel Free