gpt4 book ai didi

org.springframework.boot.web.context.WebServerApplicationContext.getWebServer()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 04:11:05 28 4
gpt4 key购买 nike

本文整理了Java中org.springframework.boot.web.context.WebServerApplicationContext.getWebServer()方法的一些代码示例,展示了WebServerApplicationContext.getWebServer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebServerApplicationContext.getWebServer()方法的具体详情如下:
包路径:org.springframework.boot.web.context.WebServerApplicationContext
类名称:WebServerApplicationContext
方法名:getWebServer

WebServerApplicationContext.getWebServer介绍

[英]Returns the WebServer that was created by the context or null if the server has not yet been created.
[中]返回由上下文创建的Web服务器,如果服务器尚未创建,则返回null。

代码示例

代码示例来源:origin: line/armeria

@Test
public void verifySingleConnector() {
  // Relevant to Tomcat 9.0
  assertThat(applicationContext).isInstanceOf(WebServerApplicationContext.class);
  WebServer webServer = ((WebServerApplicationContext) applicationContext).getWebServer();
  assertThat(webServer).isInstanceOf(TomcatWebServer.class);
  assertThat(((TomcatWebServer) webServer).getTomcat()
                      .getEngine()
                      .getService()
                      .findConnectors()).hasSize(1);
}

代码示例来源:origin: org.springframework.boot/spring-boot-actuator

private ThreadPool findThreadPool(ApplicationContext applicationContext) {
  if (applicationContext instanceof WebServerApplicationContext) {
    WebServer webServer = ((WebServerApplicationContext) applicationContext)
        .getWebServer();
    if (webServer instanceof JettyWebServer) {
      return ((JettyWebServer) webServer).getServer().getThreadPool();
    }
  }
  return null;
}

代码示例来源:origin: org.springframework.boot/spring-boot-actuator

private Manager findManager(ApplicationContext applicationContext) {
  if (applicationContext instanceof WebServerApplicationContext) {
    WebServer webServer = ((WebServerApplicationContext) applicationContext)
        .getWebServer();
    if (webServer instanceof TomcatWebServer) {
      Context context = findContext((TomcatWebServer) webServer);
      return context.getManager();
    }
  }
  return null;
}

代码示例来源:origin: org.springframework.boot/spring-boot-actuator-autoconfigure

@Override
public void afterSingletonsInstantiated() {
  if (this.applicationContext instanceof WebServerApplicationContext
      && ((WebServerApplicationContext) this.applicationContext)
          .getWebServer() != null) {
    ConfigurableWebServerApplicationContext managementContext = this.managementContextFactory
        .createManagementContext(this.applicationContext,
            EnableChildManagementContextConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    managementContext.setServerNamespace("management");
    managementContext.setId(this.applicationContext.getId() + ":management");
    setClassLoaderIfPossible(managementContext);
    CloseManagementContextListener.addIfPossible(this.applicationContext,
        managementContext);
    managementContext.refresh();
  }
  else {
    logger.warn("Could not start embedded management container on "
        + "different port (management endpoints are still available "
        + "through JMX)");
  }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com