当前位置: 首页>>代码示例>>Java>>正文


Java BeanManager.resolve方法代码示例

本文整理汇总了Java中javax.enterprise.inject.spi.BeanManager.resolve方法的典型用法代码示例。如果您正苦于以下问题:Java BeanManager.resolve方法的具体用法?Java BeanManager.resolve怎么用?Java BeanManager.resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.enterprise.inject.spi.BeanManager的用法示例。


在下文中一共展示了BeanManager.resolve方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testVertxBean

import javax.enterprise.inject.spi.BeanManager; //导入方法依赖的package包/类
@Test
public void testVertxBean() {
    BeanManager beanManager = CDI.current().getBeanManager();
    Bean<?> bean = beanManager.resolve(beanManager.getBeans(Vertx.class));
    assertTrue(bean.getTypes().contains(Vertx.class));
    assertTrue(bean.getTypes().contains(Measured.class));
    Class<?> vertxClass = vertx.getClass();
    for (Class<?> intf : vertxClass.getInterfaces()) {
        assertTrue(bean.getTypes().contains(intf));
    }
}
 
开发者ID:weld,项目名称:weld-vertx,代码行数:12,代码来源:WeldVertxObserversTest.java

示例2: lookup

import javax.enterprise.inject.spi.BeanManager; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Object lookup(String name, BeanManager bm) {
    Set<Bean<?>> beans = bm.getBeans(name);
    if (beans.isEmpty()) {
        throw new IllegalStateException("CDI BeanManager cannot find an instance of requested type '" + name + "'");
    }
    Bean bean = bm.resolve(beans);
    CreationalContext ctx = bm.createCreationalContext(bean);
    // select one beantype randomly. A bean has a non-empty set of
    // beantypes.
    Type type = (Type) bean.getTypes().iterator().next();
    return bm.getReference(bean, type, ctx);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:14,代码来源:ProgrammaticBeanLookup.java

示例3: testContextBean

import javax.enterprise.inject.spi.BeanManager; //导入方法依赖的package包/类
@Test
public void testContextBean() {
    BeanManager beanManager = CDI.current().getBeanManager();
    Bean<?> bean = beanManager.resolve(beanManager.getBeans(Context.class));
    assertTrue(bean.getTypes().contains(Context.class));
}
 
开发者ID:weld,项目名称:weld-vertx,代码行数:7,代码来源:WeldVertxObserversTest.java

示例4: getCalledMethods

import javax.enterprise.inject.spi.BeanManager; //导入方法依赖的package包/类
private CalledMethods getCalledMethods() {
    final BeanManager beanManager = CDI.current().getBeanManager();
    final Bean<?> resolve = beanManager.resolve(beanManager.getBeans(CalledMethods.class));
    return (CalledMethods) beanManager.getReference(resolve, CalledMethods.class, beanManager.createCreationalContext(resolve));
}
 
开发者ID:eclipse,项目名称:yasson,代码行数:6,代码来源:CdiInjectionTest.java

示例5: getCamelContextById

import javax.enterprise.inject.spi.BeanManager; //导入方法依赖的package包/类
static CamelContext getCamelContextById(BeanManager manager, String camelContextId) {
    Bean<?> bean = manager.resolve(manager.getBeans(camelContextId));
    return (CamelContext) manager.getReference(bean, CamelContext.class, manager.createCreationalContext(bean));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:BeanManagerHelper.java

示例6: getDefaultCamelContext

import javax.enterprise.inject.spi.BeanManager; //导入方法依赖的package包/类
static CamelContext getDefaultCamelContext(BeanManager manager) {
    Bean<?> bean = manager.resolve(manager.getBeans(CamelContext.class));
    return (CamelContext) manager.getReference(bean, CamelContext.class, manager.createCreationalContext(bean));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:BeanManagerHelper.java

示例7: newBean

import javax.enterprise.inject.spi.BeanManager; //导入方法依赖的package包/类
/**
 * Create a new CDI bean given its class and a bean manager. The bean is created
 * in the context defined by the scope annotation on the class.
 *
 * @param bm The BeanManager.
 * @param clazz CDI class.
 * @param <T>   class parameter.
 * @return newly allocated CDI bean.
 */
public static <T> T newBean(BeanManager bm, Class<T> clazz) {
    Set<Bean<?>> beans = bm.getBeans(clazz);
    final Bean<T> bean = (Bean<T>) bm.resolve(beans);
    final CreationalContext<T> ctx = bm.createCreationalContext(bean);
    return (T) bm.getReference(bean, clazz, ctx);
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:16,代码来源:CdiUtils.java

示例8: getBean

import javax.enterprise.inject.spi.BeanManager; //导入方法依赖的package包/类
/**
 * Get the named bean
 *
 * @param <T>  type of bean
 * @param name name of bean
 *
 * @return
 */
public static <T> Bean<T> getBean( String name )
{
    BeanManager beanManager = getBeanManager();
    Set beans = beanManager.getBeans( name );
    return beanManager.resolve( beans );
}
 
开发者ID:peter-mount,项目名称:opendata-common,代码行数:15,代码来源:CDIUtils.java

示例9: getInstance

import javax.enterprise.inject.spi.BeanManager; //导入方法依赖的package包/类
/**
 * Return the instance of a bean
 *
 * @param <T>        type of bean
 * @param clazz      class of bean
 * @param qualifiers qualifiers
 *
 * @return
 */
public static <T> T getInstance( Class<T> clazz, Annotation... qualifiers )
{
    BeanManager beanManager = getBeanManager();
    Set beans = beanManager.getBeans( clazz, qualifiers );
    Bean<T> bean = beanManager.resolve( beans );
    CreationalContext<T> ctx = beanManager.createCreationalContext( bean );
    return (T) beanManager.getReference( bean, clazz, ctx );
}
 
开发者ID:peter-mount,项目名称:opendata-common,代码行数:18,代码来源:CDIUtils.java


注:本文中的javax.enterprise.inject.spi.BeanManager.resolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。