use of org.springframework.boot.SpringApplication in project pinpoint by naver.
the class ProfileResolveListener method onApplicationEvent.
@Override
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
logger.info(String.format("onApplicationEvent(%s)", event.getClass().getSimpleName()));
ConfigurableEnvironment environment = event.getEnvironment();
SpringApplication springApplication = event.getSpringApplication();
ProfileEnvironmentPostProcessor profileEnvironment = new ProfileEnvironmentPostProcessor();
profileEnvironment.postProcessEnvironment(environment, springApplication);
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class SharedMetadataReaderFactoryContextInitializerTests method checkOrderOfInitializer.
@Test
@SuppressWarnings("unchecked")
void checkOrderOfInitializer() {
SpringApplication application = new SpringApplication(TestConfig.class);
application.setWebApplicationType(WebApplicationType.NONE);
List<ApplicationContextInitializer<?>> initializers = (List<ApplicationContextInitializer<?>>) ReflectionTestUtils.getField(application, "initializers");
// Simulate what would happen if an initializer was added using spring.factories
// and happened to be loaded first
initializers.add(0, new Initializer());
GenericApplicationContext context = (GenericApplicationContext) application.run();
BeanDefinition definition = context.getBeanDefinition(SharedMetadataReaderFactoryContextInitializer.BEAN_NAME);
assertThat(definition.getAttribute("seen")).isEqualTo(true);
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class MyApplication method main.
public static void main(String[] args) {
SpringApplication application = new SpringApplication(MyApplication.class);
application.setBannerMode(Banner.Mode.OFF);
application.run(args);
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class LoggingApplicationListenerTests method shutdownHookIsRegisteredByDefault.
@Test
void shutdownHookIsRegisteredByDefault() throws Exception {
TestLoggingApplicationListener listener = new TestLoggingApplicationListener();
Object registered = ReflectionTestUtils.getField(listener, TestLoggingApplicationListener.class, "shutdownHookRegistered");
((AtomicBoolean) registered).set(false);
System.setProperty(LoggingSystem.class.getName(), TestShutdownHandlerLoggingSystem.class.getName());
multicastEvent(listener, new ApplicationStartingEvent(this.bootstrapContext, new SpringApplication(), NO_ARGS));
listener.initialize(this.context.getEnvironment(), this.context.getClassLoader());
assertThat(listener.shutdownHook).isNotNull();
listener.shutdownHook.run();
assertThat(TestShutdownHandlerLoggingSystem.shutdownLatch.await(30, TimeUnit.SECONDS)).isTrue();
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class ConfigDataEnvironmentPostProcessorIntegrationTests method setup.
@BeforeEach
void setup() {
this.application = new SpringApplication(Config.class);
this.application.setWebApplicationType(WebApplicationType.NONE);
}
Aggregations