Search in sources :

Example 91 with SpringApplication

use of org.springframework.boot.SpringApplication in project sofa-ark by alipay.

the class IntrospectBizEndpointOnArkEnabledTest method testIntrospectBizEndpoint.

@Test
public void testIntrospectBizEndpoint() {
    SpringApplication springApplication = new SpringApplication(IntrospectBizEndpointOnArkDisabledTest.EmptyConfiguration.class);
    ConfigurableApplicationContext applicationContext = springApplication.run(new String[] {});
    Assert.assertTrue(applicationContext.containsBean("introspectBizEndpoint"));
    Assert.assertTrue(applicationContext.containsBean("introspectBizEndpointMvcAdapter"));
    applicationContext.close();
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) SpringApplication(org.springframework.boot.SpringApplication) Test(org.junit.Test)

Example 92 with SpringApplication

use of org.springframework.boot.SpringApplication in project incubator-dubbo-spring-boot-project by apache.

the class DubboServletContainerProviderBootstrap method main.

public static void main(String[] args) {
    // Run as the generic Spring Boot Web(Servlet) Application
    SpringApplication application = new SpringApplication(DubboServletContainerProviderBootstrap.class);
    application.setWebApplicationType(WebApplicationType.SERVLET);
    application.run(args);
}
Also used : SpringApplication(org.springframework.boot.SpringApplication)

Example 93 with SpringApplication

use of org.springframework.boot.SpringApplication in project jphp by jphp-compiler.

the class PWebServer method __construct.

@Signature
public void __construct(Invoker invoker) {
    application = new SpringApplication(WebServerConfig.class);
    defaultProperties = new HashMap<>();
    defaultProperties.put("_server.id", id);
    defaultProperties.put("server.port", 8080);
    application.setDefaultProperties(defaultProperties);
    onRequest = invoker;
    importAutoloaders = true;
    isolated = true;
    hotReload = true;
    WebServerController.registerServer(this);
}
Also used : SpringApplication(org.springframework.boot.SpringApplication) WebServerConfig(org.develnext.jphp.ext.webserver.WebServerConfig)

Example 94 with SpringApplication

use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.

the class AutoConfigurationReportLoggingInitializerTests method logsDebugOnError.

@Test
public void logsDebugOnError() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    this.initializer.initialize(context);
    context.register(ErrorConfig.class);
    try {
        context.refresh();
        fail("Did not error");
    } catch (Exception ex) {
        this.initializer.onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), new String[0], context, ex));
    }
    assertThat(this.debugLog.size()).isNotEqualTo(0);
    assertThat(this.infoLog.size()).isEqualTo(0);
}
Also used : ApplicationFailedEvent(org.springframework.boot.context.event.ApplicationFailedEvent) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) SpringApplication(org.springframework.boot.SpringApplication) LogConfigurationException(org.apache.commons.logging.LogConfigurationException) Test(org.junit.Test)

Example 95 with SpringApplication

use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.

the class AutoConfigurationReportLoggingInitializerTests method noErrorIfNotInitialized.

@Test
public void noErrorIfNotInitialized() throws Exception {
    this.initializer.onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), new String[0], null, new RuntimeException("Planned")));
    assertThat(this.infoLog.get(0)).contains("Unable to provide auto-configuration report");
}
Also used : ApplicationFailedEvent(org.springframework.boot.context.event.ApplicationFailedEvent) SpringApplication(org.springframework.boot.SpringApplication) Test(org.junit.Test)

Aggregations

SpringApplication (org.springframework.boot.SpringApplication)205 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)56 Test (org.junit.Test)43 Test (org.junit.jupiter.api.Test)39 Environment (org.springframework.core.env.Environment)21 ConfigurableEnvironment (org.springframework.core.env.ConfigurableEnvironment)15 HashMap (java.util.HashMap)9 ApplicationFailedEvent (org.springframework.boot.context.event.ApplicationFailedEvent)9 ApplicationReadyEvent (org.springframework.boot.context.event.ApplicationReadyEvent)9 ApplicationStartingEvent (org.springframework.boot.context.event.ApplicationStartingEvent)9 File (java.io.File)7 SpringApplicationBuilder (org.springframework.boot.builder.SpringApplicationBuilder)7 BeforeEach (org.junit.jupiter.api.BeforeEach)6 JavaLoggingSystem (org.springframework.boot.logging.java.JavaLoggingSystem)6 ApplicationContext (org.springframework.context.ApplicationContext)6 ApplicationPreparedEvent (org.springframework.boot.context.event.ApplicationPreparedEvent)5 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)5 Assertions.catchThrowable (org.assertj.core.api.Assertions.catchThrowable)4 JoranException (ch.qos.logback.core.joran.spi.JoranException)3 IOException (java.io.IOException)3