org.springframework.boot.web.context.WebServerApplicationContext Java Examples

The following examples show how to use org.springframework.boot.web.context.WebServerApplicationContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServiceDiscoveryConfiguration.java    From Kafdrop with Apache License 2.0 5 votes vote down vote up
@Bean
public ServiceDiscoveryApplicationListener serviceDiscoveryStartupListener(WebServerApplicationContext webContext,
                                                                           ServiceDiscovery serviceDiscovery,
                                                                           Environment environment,
                                                                           InfoEndpoint infoEndpoint)
{
   return new ServiceDiscoveryApplicationListener(webContext, serviceDiscovery, environment, infoEndpoint);
}
 
Example #2
Source File: ServiceDiscoveryConfiguration.java    From Kafdrop with Apache License 2.0 5 votes vote down vote up
public ServiceDiscoveryApplicationListener(WebServerApplicationContext webContext,
                                           ServiceDiscovery serviceDiscovery,
                                           Environment environment,
                                           InfoEndpoint infoEndpoint)
{
   this.webContext = webContext;
   this.serviceDiscovery = serviceDiscovery;
   this.environment = environment;
   this.infoEndpoint = infoEndpoint;
}
 
Example #3
Source File: SpringTomcatApplication.java    From armeria with Apache License 2.0 5 votes vote down vote up
/**
 * Bean to configure Armeria Tomcat service.
 * @return configuration bean.
 */
@Bean
public ArmeriaServerConfigurator armeriaTomcat() {
    final WebServer webServer = ((WebServerApplicationContext) applicationContext).getWebServer();
    if (webServer instanceof TomcatWebServer) {
        final Tomcat tomcat = ((TomcatWebServer) webServer).getTomcat();

        return serverBuilder -> serverBuilder.service("prefix:/tomcat/api/rest/v1",
                                                      TomcatService.of(tomcat));
    }
    return serverBuilder -> { };
}
 
Example #4
Source File: SpringTomcatApplicationItTest.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Test
public void verifySingleConnector() {
    // Relevant to Tomcat 9.0
    assertThat(applicationContext).isInstanceOf(WebServerApplicationContext.class);
    final WebServer webServer = ((WebServerApplicationContext) applicationContext).getWebServer();
    assertThat(webServer).isInstanceOf(TomcatWebServer.class);
    assertThat(((TomcatWebServer) webServer).getTomcat()
                                            .getEngine()
                                            .getService()
                                            .findConnectors()).hasSize(1);
}
 
Example #5
Source File: DefaultApplicationFactoryTest.java    From spring-boot-admin with Apache License 2.0 4 votes vote down vote up
@Override
public WebServerApplicationContext getApplicationContext() {
	return context;
}
 
Example #6
Source File: ServletApplicationFactoryTest.java    From spring-boot-admin with Apache License 2.0 4 votes vote down vote up
@Override
public WebServerApplicationContext getApplicationContext() {
	return context;
}