Search in sources :

Example 11 with StartupStep

use of org.springframework.core.metrics.StartupStep in project spring-boot by spring-projects.

the class StartupEndpointDocumentationTests method appendSampleStartupSteps.

@BeforeEach
void appendSampleStartupSteps(@Autowired BufferingApplicationStartup applicationStartup) {
    StartupStep starting = applicationStartup.start("spring.boot.application.starting");
    starting.tag("mainApplicationClass", "com.example.startup.StartupApplication");
    StartupStep instantiate = applicationStartup.start("spring.beans.instantiate");
    instantiate.tag("beanName", "homeController");
    instantiate.end();
    starting.end();
}
Also used : StartupStep(org.springframework.core.metrics.StartupStep) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with StartupStep

use of org.springframework.core.metrics.StartupStep in project spring-framework by spring-projects.

the class AnnotationConfigApplicationContext method scan.

/**
 * Perform a scan within the specified base packages.
 * <p>Note that {@link #refresh()} must be called in order for the context
 * to fully process the new classes.
 * @param basePackages the packages to scan for component classes
 * @see #register(Class...)
 * @see #refresh()
 */
@Override
public void scan(String... basePackages) {
    Assert.notEmpty(basePackages, "At least one base package must be specified");
    StartupStep scanPackages = this.getApplicationStartup().start("spring.context.base-packages.scan").tag("packages", () -> Arrays.toString(basePackages));
    this.scanner.scan(basePackages);
    scanPackages.end();
}
Also used : StartupStep(org.springframework.core.metrics.StartupStep)

Aggregations

StartupStep (org.springframework.core.metrics.StartupStep)12 Test (org.junit.jupiter.api.Test)6 BeforeEach (org.junit.jupiter.api.BeforeEach)3 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 LinkedHashSet (java.util.LinkedHashSet)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Supplier (java.util.function.Supplier)2 PostConstruct (javax.annotation.PostConstruct)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 Assertions.assertThatExceptionOfType (org.assertj.core.api.Assertions.assertThatExceptionOfType)2 Assertions.assertThatIllegalArgumentException (org.assertj.core.api.Assertions.assertThatIllegalArgumentException)2 Assertions.assertThatIllegalStateException (org.assertj.core.api.Assertions.assertThatIllegalStateException)2 Assertions.assertThatNoException (org.assertj.core.api.Assertions.assertThatNoException)2