use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class ResourceServerTokenServicesConfigurationTests method useRemoteTokenServices.
@Test
public void useRemoteTokenServices() {
EnvironmentTestUtils.addEnvironment(this.environment, "security.oauth2.resource.tokenInfoUri:http://example.com", "security.oauth2.resource.clientId=acme");
this.context = new SpringApplicationBuilder(ResourceConfiguration.class).environment(this.environment).web(WebApplicationType.NONE).run();
RemoteTokenServices services = this.context.getBean(RemoteTokenServices.class);
assertThat(services).isNotNull();
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class ShutdownParentEndpointTests method shutdownChild.
@Test
public void shutdownChild() throws Exception {
this.context = new SpringApplicationBuilder(Config.class).child(Empty.class).web(WebApplicationType.NONE).run();
CountDownLatch latch = this.context.getBean(Config.class).latch;
assertThat((String) getEndpointBean().invoke().get("message")).startsWith("Shutting down");
assertThat(this.context.isActive()).isTrue();
assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class SpringApplicationAdminJmxAutoConfigurationTests method registerWithSimpleWebApp.
@Test
public void registerWithSimpleWebApp() throws Exception {
this.context = new SpringApplicationBuilder().sources(ServletWebServerFactoryAutoConfiguration.class, DispatcherServletAutoConfiguration.class, JmxAutoConfiguration.class, SpringApplicationAdminJmxAutoConfiguration.class).run("--" + ENABLE_ADMIN_PROP, "--server.port=0");
assertThat(this.context).isInstanceOf(ServletWebServerApplicationContext.class);
assertThat(this.mBeanServer.getAttribute(createDefaultObjectName(), "EmbeddedWebApplication")).isEqualTo(Boolean.TRUE);
int expected = ((ServletWebServerApplicationContext) this.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 camel by apache.
the class Configuration method shouldOnlyCollectRoutesOnce.
@Test
public void shouldOnlyCollectRoutesOnce() {
GenericApplicationContext parent = new GenericApplicationContext();
parent.refresh();
ConfigurableApplicationContext context = new SpringApplicationBuilder(Configuration.class).web(false).parent(parent).run();
ContextRefreshedEvent refreshEvent = new ContextRefreshedEvent(context);
RoutesCollector collector = context.getBean(RoutesCollector.class);
//no changes should happen here
collector.onApplicationEvent(refreshEvent);
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project libresonic by Libresonic.
the class Application method main.
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder();
doConfigure(builder).run(args);
}
Aggregations