本文整理了Java中javax.enterprise.inject.spi.CDI.setCDIProvider()
方法的一些代码示例,展示了CDI.setCDIProvider()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CDI.setCDIProvider()
方法的具体详情如下:
包路径:javax.enterprise.inject.spi.CDI
类名称:CDI
方法名:setCDIProvider
[英]Set the CDIProvider to use.
If a CDIProvider is set using this method, any provider specified as a service provider will not be used.
[中]将CDIProvider设置为使用。
如果使用此方法设置CDIProvider,则不会使用指定为服务提供程序的任何提供程序。
代码示例来源:origin: org.ops4j.pax.cdi/pax-cdi-extender
synchronized void start() {
// set JVM (or at least javax.enterprise:cdi-api revision) wide CDI Provider
CDI.setCDIProvider(cdiProvider);
log.info("starting CDI extender {}", context.getBundle().getSymbolicName());
this.listenerTracker = new ServiceTracker<>(context, CdiWebAdapter.class, this);
this.listenerTracker.open();
this.bundleWatcher = new BundleTracker<>(context, Bundle.ACTIVE, this);
this.bundleWatcher.open();
}
代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl
@Test
@SpecAssertions({ @SpecAssertion(section = Sections.PROVIDER, id = "da"), @SpecAssertion(section = Sections.PROVIDER, id = "c") })
public void testCustomCDIProvider() {
CDI.setCDIProvider(new CustomCDIProvider());
Assert.assertNull(CDI.current());
Assert.assertTrue(CustomCDIProvider.initializedCalled);
}
代码示例来源:origin: weld/core
@Test
public void testCustomCDIProvider() {
try {
CustomCDIProvider.reset();
CDI.setCDIProvider(new CustomCDIProvider());
assertNull(CDI.current());
assertTrue(CustomCDIProvider.isCalled);
} finally {
// Unset the CDIProvider so that other tests are not affected
TestCDI.unsetCDIProvider();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!