/** * create a bean in context * @param b the Bean as described and found by the weld init. * @param scope either ApplicationScoped or Dependent * @return the created bean */ public Object create(Contextual<T> b, Class<? extends Annotation> scope) { try { final CreationalContext<T> cb = bm.createCreationalContext(b); // assumes the bean will exist only once Context context = bm.getContext(scope); final Object o = context.get(b, cb); creationalContexts.add(cb); return o; } catch (Throwable thw) { getLogger().error("Exception during create of Bean {}", b); getLogger().error("Exception: ", thw); throw new RuntimeException(thw); } }
/** * create a bean in context * @param b the Bean as described and found by the weld init. * @param scope either ApplicationScoped or Dependent * @return the created bean */ public Object create(Contextual<T> b, Class<? extends Annotation> scope) { try { final CreationalContext<T> cb = bm.createCreationalContext(b); // assumes the bean will exist only once Context context = bm.getContext(scope); final Object o = context.get(b, cb); creationalContexts.add(cb); return o; } catch (Throwable thw) { getLogger().error("Exception during create of Bean {}", b); getLogger().error("Exception: ", thw); throw new RuntimeException(thw); } }