use of org.springframework.boot.builder.SpringApplicationBuilder in project pinpoint by naver.
the class BasicStarter method start.
public void start(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder();
builder.sources(sources);
builder.web(WebApplicationType.SERVLET);
builder.bannerMode(Banner.Mode.OFF);
builder.listeners(new ProfileResolveListener());
builder.listeners(new EnvironmentLoggingListener());
builder.listeners(new ExternalEnvironmentListener(externalPropertySourceName, externalConfigurationKey));
builder.listeners(new PinpointSpringBanner());
SpringApplication springApplication = builder.build();
springApplication.run(args);
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class SpringApplicationAdminJmxAutoConfigurationTests method registerWithSimpleWebApp.
@Test
void registerWithSimpleWebApp() throws Exception {
try (ConfigurableApplicationContext context = new SpringApplicationBuilder().sources(ServletWebServerFactoryAutoConfiguration.class, DispatcherServletAutoConfiguration.class, MultipleMBeanExportersConfiguration.class, SpringApplicationAdminJmxAutoConfiguration.class).run("--" + ENABLE_ADMIN_PROP, "--server.port=0")) {
assertThat(context).isInstanceOf(ServletWebServerApplicationContext.class);
assertThat(this.server.getAttribute(createDefaultObjectName(), "EmbeddedWebApplication")).isEqualTo(Boolean.TRUE);
int expected = ((ServletWebServerApplicationContext) context).getWebServer().getPort();
String actual = getProperty(createDefaultObjectName(), "local.server.port");
assertThat(actual).isEqualTo(String.valueOf(expected));
}
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class LoggingApplicationListenerIntegrationTests method loggingSystemRegisteredInTheContext.
@Test
void loggingSystemRegisteredInTheContext() {
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(SampleService.class).web(WebApplicationType.NONE).run()) {
SampleService service = context.getBean(SampleService.class);
assertThat(service.loggingSystem).isNotNull();
}
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class LoggingApplicationListenerIntegrationTests method loggingPerformedDuringChildApplicationStartIsNotLost.
@Test
void loggingPerformedDuringChildApplicationStartIsNotLost(CapturedOutput output) {
new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE).child(Config.class).web(WebApplicationType.NONE).listeners(new ApplicationListener<ApplicationStartingEvent>() {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
public void onApplicationEvent(ApplicationStartingEvent event) {
this.logger.info("Child application starting");
}
}).run();
assertThat(output).contains("Child application starting");
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class SpringApplicationTests method defaultPropertiesShouldBeMerged.
@Test
void defaultPropertiesShouldBeMerged() {
MockEnvironment environment = new MockEnvironment();
environment.getPropertySources().addFirst(new MapPropertySource(DefaultPropertiesPropertySource.NAME, Collections.singletonMap("bar", "foo")));
SpringApplication application = new SpringApplicationBuilder(ExampleConfig.class).environment(environment).properties("baz=bing").web(WebApplicationType.NONE).build();
this.context = application.run();
assertThat(getEnvironment().getProperty("bar")).isEqualTo("foo");
assertThat(getEnvironment().getProperty("baz")).isEqualTo("bing");
}
Aggregations