use of org.springframework.context.support.GenericApplicationContext in project zeppelin by apache.
the class LensBootstrap method getLensJLineShellComponent.
public LensJLineShellComponent getLensJLineShellComponent() {
GenericApplicationContext ctx = (GenericApplicationContext) getApplicationContext();
RootBeanDefinition rbd = new RootBeanDefinition();
rbd.setBeanClass(LensJLineShellComponent.class);
DefaultListableBeanFactory bf = (DefaultListableBeanFactory) ctx.getBeanFactory();
bf.registerBeanDefinition(LensJLineShellComponent.class.getSimpleName(), rbd);
return ctx.getBean(LensJLineShellComponent.class);
}
use of org.springframework.context.support.GenericApplicationContext in project cucumber-jvm by cucumber.
the class CucumberTestContextManager method createFallbackContext.
@SuppressWarnings("resource")
private ConfigurableListableBeanFactory createFallbackContext() {
ConfigurableApplicationContext applicationContext;
if (getClass().getClassLoader().getResource("cucumber.xml") != null) {
applicationContext = new ClassPathXmlApplicationContext("cucumber.xml");
} else {
applicationContext = new GenericApplicationContext();
}
applicationContext.registerShutdownHook();
ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
beanFactory.registerScope(GlueCodeScope.NAME, new GlueCodeScope());
for (Class<?> stepClass : stepClasses) {
registerStepClassBeanDefinition(beanFactory, stepClass);
}
return beanFactory;
}
use of org.springframework.context.support.GenericApplicationContext in project spring-boot by spring-projects.
the class EndpointMBeanExporterTests method testRegistrationWithDifferentDomain.
@Test
public void testRegistrationWithDifferentDomain() throws Exception {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class, null, new MutablePropertyValues(Collections.singletonMap("domain", "test-domain"))));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(TestEndpoint.class));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertThat(mbeanExporter.getServer().getMBeanInfo(getObjectName("test-domain", "endpoint1", false, this.context))).isNotNull();
}
use of org.springframework.context.support.GenericApplicationContext in project spring-boot by spring-projects.
the class EndpointMBeanExporterTests method testSkipRegistrationOfDisabledEndpoint.
@Test
public void testSkipRegistrationOfDisabledEndpoint() throws Exception {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class));
MutablePropertyValues mpv = new MutablePropertyValues();
mpv.add("enabled", Boolean.FALSE);
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(TestEndpoint.class, null, mpv));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertThat(mbeanExporter.getServer().isRegistered(getObjectName("endpoint1", this.context))).isFalse();
}
use of org.springframework.context.support.GenericApplicationContext in project spring-boot by spring-projects.
the class EndpointMBeanExporterTests method registerLoggersEndpoint.
private MBeanExporter registerLoggersEndpoint() {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class));
RootBeanDefinition bd = new RootBeanDefinition(LoggersEndpoint.class);
ConstructorArgumentValues values = new ConstructorArgumentValues();
values.addIndexedArgumentValue(0, new LogbackLoggingSystem(getClass().getClassLoader()));
bd.setConstructorArgumentValues(values);
this.context.registerBeanDefinition("loggersEndpoint", bd);
this.context.refresh();
return this.context.getBean(EndpointMBeanExporter.class);
}
Aggregations