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

shouldPublishLifecycleEvents() — spring-boot Function Reference

Architecture documentation for the shouldPublishLifecycleEvents() function in EventPublishingRunListenerTests.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  ba6fef92_1e35_fe47_1949_f3b5d0049f8b["shouldPublishLifecycleEvents()"]
  ab7d7a5d_2b51_950c_9190_353313bf7e19["getListeners()"]
  ba6fef92_1e35_fe47_1949_f3b5d0049f8b -->|calls| ab7d7a5d_2b51_950c_9190_353313bf7e19
  9ffb0227_1503_fe35_5907_430efb756850["assertReceivedNoEvents()"]
  ba6fef92_1e35_fe47_1949_f3b5d0049f8b -->|calls| 9ffb0227_1503_fe35_5907_430efb756850
  58693b90_5c44_e232_8ac7_ef1866400e09["assertReceivedEvent()"]
  ba6fef92_1e35_fe47_1949_f3b5d0049f8b -->|calls| 58693b90_5c44_e232_8ac7_ef1866400e09
  a26ca185_1730_acf1_55b3_879c97843c59["contextLoaded()"]
  ba6fef92_1e35_fe47_1949_f3b5d0049f8b -->|calls| a26ca185_1730_acf1_55b3_879c97843c59
  7a4a5428_a780_c72f_503a_9ef35293b395["refresh()"]
  ba6fef92_1e35_fe47_1949_f3b5d0049f8b -->|calls| 7a4a5428_a780_c72f_503a_9ef35293b395
  d7c9c1bc_b766_51b0_715d_03aefa02cade["started()"]
  ba6fef92_1e35_fe47_1949_f3b5d0049f8b -->|calls| d7c9c1bc_b766_51b0_715d_03aefa02cade
  b5cf2a7e_2615_f38f_86cb_e7b136b2ac4c["ready()"]
  ba6fef92_1e35_fe47_1949_f3b5d0049f8b -->|calls| b5cf2a7e_2615_f38f_86cb_e7b136b2ac4c
  style ba6fef92_1e35_fe47_1949_f3b5d0049f8b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

core/spring-boot/src/test/java/org/springframework/boot/context/event/EventPublishingRunListenerTests.java lines 51–73

	@Test
	void shouldPublishLifecycleEvents() {
		DefaultBootstrapContext bootstrapContext = new DefaultBootstrapContext();
		StaticApplicationContext context = new StaticApplicationContext();
		TestApplicationListener applicationListener = new TestApplicationListener();
		SpringApplication application = mock(SpringApplication.class);
		given(application.getListeners()).willReturn(Collections.singleton(applicationListener));
		EventPublishingRunListener publishingListener = new EventPublishingRunListener(application, NO_ARGS);
		applicationListener.assertReceivedNoEvents();
		publishingListener.starting(bootstrapContext);
		applicationListener.assertReceivedEvent(ApplicationStartingEvent.class);
		publishingListener.environmentPrepared(bootstrapContext, new MockEnvironment());
		applicationListener.assertReceivedEvent(ApplicationEnvironmentPreparedEvent.class);
		publishingListener.contextPrepared(context);
		applicationListener.assertReceivedEvent(ApplicationContextInitializedEvent.class);
		publishingListener.contextLoaded(context);
		applicationListener.assertReceivedEvent(ApplicationPreparedEvent.class);
		context.refresh();
		publishingListener.started(context, null);
		applicationListener.assertReceivedEvent(ApplicationStartedEvent.class, AvailabilityChangeEvent.class);
		publishingListener.ready(context, null);
		applicationListener.assertReceivedEvent(ApplicationReadyEvent.class, AvailabilityChangeEvent.class);
	}

Domain

Subdomains

Calls

Frequently Asked Questions

What does shouldPublishLifecycleEvents() do?
shouldPublishLifecycleEvents() is a function in the spring-boot codebase.
What does shouldPublishLifecycleEvents() call?
shouldPublishLifecycleEvents() calls 7 function(s): assertReceivedEvent, assertReceivedNoEvents, contextLoaded, getListeners, ready, refresh, started.

Analyze Your Own Codebase

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

Try Supermodel Free