use of org.springframework.boot.web.context.ConfigurableWebServerApplicationContext in project spring-native by spring-projects-experimental.
the class AotManagementContextFactoryTests method createManagementContextWithReactiveEnv.
@Test
void createManagementContextWithReactiveEnv() {
AotManagementContextFactory factory = new AotManagementContextFactory(this::testContextInitializer, true);
GenericApplicationContext parent = mock(GenericApplicationContext.class);
ConfigurableWebServerApplicationContext managementContext = factory.createManagementContext(parent, DummyConfiguration.class);
assertThat(managementContext).isExactlyInstanceOf(ReactiveWebServerApplicationContext.class).satisfies(managementContext(parent));
}
use of org.springframework.boot.web.context.ConfigurableWebServerApplicationContext in project spring-cloud-consul by spring-cloud.
the class ConsulAutoServiceRegistrationListener method onApplicationEvent.
@Override
public void onApplicationEvent(ApplicationEvent applicationEvent) {
if (applicationEvent instanceof WebServerInitializedEvent) {
WebServerInitializedEvent event = (WebServerInitializedEvent) applicationEvent;
ApplicationContext context = event.getApplicationContext();
if (context instanceof ConfigurableWebServerApplicationContext) {
if ("management".equals(((ConfigurableWebServerApplicationContext) context).getServerNamespace())) {
return;
}
}
this.autoServiceRegistration.setPortIfNeeded(event.getWebServer().getPort());
this.autoServiceRegistration.start();
}
}
use of org.springframework.boot.web.context.ConfigurableWebServerApplicationContext in project spring-native by spring-projects-experimental.
the class AotManagementContextFactoryTests method createManagementContextWithServletEnv.
@Test
void createManagementContextWithServletEnv() {
AotManagementContextFactory factory = new AotManagementContextFactory(this::testContextInitializer, false);
GenericApplicationContext parent = mock(GenericApplicationContext.class);
ConfigurableWebServerApplicationContext managementContext = factory.createManagementContext(parent, DummyConfiguration.class);
assertThat(managementContext).isExactlyInstanceOf(ServletWebServerApplicationContext.class).satisfies(managementContext(parent));
}
use of org.springframework.boot.web.context.ConfigurableWebServerApplicationContext in project spring-native by spring-projects-experimental.
the class AotManagementContextFactory method createManagementContext.
@Override
public ConfigurableWebServerApplicationContext createManagementContext(ApplicationContext parent, Class<?>... configurationClasses) {
ConfigurableWebServerApplicationContext actuatorContext = createContext();
actuatorContext.setParent(parent);
actuatorContextInitializer.get().initialize((GenericApplicationContext) actuatorContext);
return actuatorContext;
}
use of org.springframework.boot.web.context.ConfigurableWebServerApplicationContext in project spring-cloud-huawei-samples by huaweicloud.
the class ServiceCombListener method onApplicationEvent.
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
ApplicationContext context = event.getApplicationContext();
if (context instanceof ConfigurableWebServerApplicationContext) {
if ("management".equals(((ConfigurableWebServerApplicationContext) context).getServerNamespace())) {
return;
}
}
registration.start();
}
Aggregations