本文整理汇总了Java中org.apache.deltaspike.cdise.api.CdiContainer.boot方法的典型用法代码示例。如果您正苦于以下问题:Java CdiContainer.boot方法的具体用法?Java CdiContainer.boot怎么用?Java CdiContainer.boot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.deltaspike.cdise.api.CdiContainer
的用法示例。
在下文中一共展示了CdiContainer.boot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyBeforeFeatureConfig
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
void applyBeforeFeatureConfig(Class testClass) {
CdiContainer container = CdiContainerLoader.getCdiContainer();
if (!isContainerStarted()) {
container.boot(CdiTestSuiteRunner.getTestContainerConfig());
containerStarted = true;
bootExternalContainers(testClass);
}
List<Class<? extends Annotation>> restrictedScopes = new ArrayList<Class<? extends Annotation>>();
//controlled by the container and not supported by weld:
restrictedScopes.add(ApplicationScoped.class);
restrictedScopes.add(Singleton.class);
if (this.parent == null && this.testControl.getClass().equals(TestControlLiteral.class)) {
//skip scope-handling if @TestControl isn't used explicitly on the test-class -> TODO re-visit it
restrictedScopes.add(RequestScoped.class);
restrictedScopes.add(SessionScoped.class);
}
this.previousProjectStage = ProjectStageProducer.getInstance().getProjectStage();
ProjectStageProducer.setProjectStage(this.projectStage);
startScopes(container, testClass, null, restrictedScopes.toArray(new Class[restrictedScopes.size()]));
}
示例2: main
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
final CdiContainer container = CdiContainerLoader.getCdiContainer();
try {
container.boot();
ContextControl contextControl = container.getContextControl();
contextControl.startContext(ApplicationScoped.class);
Quickstart quickstart = CDI.current().select(Quickstart.class).get();
quickstart.run();
} catch (Exception e) {
e.printStackTrace();
} finally {
container.shutdown();
System.out.println("Shutting down...");
System.exit(0);
}
}
示例3: shouldWork
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
@Test
public void shouldWork() {
// this will give you a CdiContainer for Weld or OWB, depending on the jar you added
CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
// now we gonna boot the CDI container. This will trigger the classpath scan, etc
cdiContainer.boot();
// and finally we like to start all built-in contexts
cdiContainer.getContextControl().startContexts();
// No specific JBoss Weld or Open Web Beans included in the test code
// finally we gonna stop the container
cdiContainer.shutdown();
}
示例4: main
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException
{
CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
cdiContainer.boot();
ContextControl contextControl = cdiContainer.getContextControl();
contextControl.startContext(ApplicationScoped.class);
GlobalResultHolder globalResultHolder =
BeanProvider.getContextualReference(GlobalResultHolder.class);
while (globalResultHolder.getCount() < 100)
{
Thread.sleep(500);
LOG.info("current count: " + globalResultHolder.getCount());
}
LOG.info("completed!");
contextControl.stopContext(ApplicationScoped.class);
cdiContainer.shutdown();
}
示例5: main
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
public static void main(String[] args)
{
CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
cdiContainer.boot();
ContextControl contextControl = cdiContainer.getContextControl();
contextControl.startContext(ApplicationScoped.class);
SettingsBean settingsBean = BeanProvider.getContextualReference(SettingsBean.class, false);
LOG.info("configured int-value #1: " + settingsBean.getIntProperty1());
LOG.info("configured long-value #2: " + settingsBean.getProperty2());
LOG.info("configured inverse-value #2: " + settingsBean.getInverseProperty());
LOG.info("configured location (custom config): " + settingsBean.getLocationId().name());
cdiContainer.shutdown();
}
示例6: testBootRequest
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
@Test
public void testBootRequest() throws Exception
{
CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
cdiContainer.boot();
cdiContainer.getContextControl().startContexts();
int port = createServer();
testRead(port);
try
{
shutdown();
}
finally
{
cdiContainer.shutdown(); //also calls #stopContexts
}
}
示例7: testContainerBoot
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
@Test
public void testContainerBoot()
{
CdiContainer cc = CdiContainerLoader.getCdiContainer();
Assert.assertNotNull(cc);
cc.boot();
cc.getContextControl().startContexts();
BeanManager bm = cc.getBeanManager();
Assert.assertNotNull(bm);
Set<Bean<?>> beans = bm.getBeans(CarRepair.class);
Bean<?> bean = bm.resolve(beans);
CarRepair carRepair = (CarRepair) bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));
Assert.assertNotNull(carRepair);
Assert.assertNotNull(carRepair.getCar());
Assert.assertNotNull(carRepair.getCar().getUser());
cc.shutdown();
}
示例8: basicInjection
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
@Test
public void basicInjection() // useless because of tcks but nice to have when working on this specific container
{
final CdiContainer container = CdiContainerLoader.getCdiContainer();
container.boot();
try
{
final BeanManager beanManager = container.getBeanManager();
assertEquals("foo", Foo.class.cast(beanManager.getReference(beanManager.resolve(beanManager.getBeans(Foo.class)), Foo.class, null)).name());
}
finally
{
container.shutdown();
}
}
示例9: doStart
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
protected void doStart() throws Exception {
CdiContainer container = CdiContainerLoader.getCdiContainer();
container.boot();
container.getContextControl().startContexts();
this.cdiContainer = container;
}
示例10: run
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
@Override
public void run(RunNotifier runNotifier)
{
CdiContainer container = CdiContainerLoader.getCdiContainer();
if (!containerStarted)
{
container.boot(CdiTestSuiteRunner.getTestContainerConfig());
containerStarted = true;
}
super.run(runNotifier);
}
示例11: doStart
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
// TODO: Use standard CDI Java SE support when CDI 2.0 becomes a prerequisite
CdiContainer container = getCdiContainer();
container.boot();
container.getContextControl().startContexts();
cdiContainer = container;
super.doStart();
postProcessContext();
warnIfNoCamelFound();
}
示例12: start
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
public void start() {
CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
cdiContainer.boot();
cdiContainer.getContextControl().startContexts();
registerShutdownHook(cdiContainer);
CDI.current().getBeanManager().fireEvent(new ApplicationStartupEvent());
}
示例13: main
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
public static void main(String...strings) {
final CdiContainer container = CdiContainerLoader.getCdiContainer();
container.boot();
container.getContextControl().startContexts();
Runtime.getRuntime().addShutdownHook(new Thread(container::shutdown));
container.getBeanManager().fireEvent(new ApplicationStartupEvent());
}
示例14: ContextControlWrapper
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
private ContextControlWrapper() {
final CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
if (!isCdiContainerBooted(cdiContainer)) {
LOG.info("booting cdi container");
long start = System.currentTimeMillis();
cdiContainer.boot();
long end = System.currentTimeMillis();
LOG.info("booting cdi container finished in " + (end - start) + " ms");
}
contextControl = cdiContainer.getContextControl();
}
示例15: startContainer
import org.apache.deltaspike.cdise.api.CdiContainer; //导入方法依赖的package包/类
protected void startContainer()
{
CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
cdiContainer.boot();
ContextControl contextControl = cdiContainer.getContextControl();
contextControl.startContext(ApplicationScoped.class);
contextControl.startContext(SessionScoped.class);
contextControl.startContext(RequestScoped.class);
}