javax.enterprise.inject.spi.CDI.select()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中javax.enterprise.inject.spi.CDI.select()方法的一些代码示例,展示了CDI.select()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CDI.select()方法的具体详情如下:
包路径:javax.enterprise.inject.spi.CDI
类名称:CDI
方法名:select

CDI.select介绍

暂无

代码示例

代码示例来源:origin: oracle/helidon

static synchronized MetricRegistry getMetricRegistry() {
  if (metricRegistry == null) {
    metricRegistry = CDI.current().select(MetricRegistry.class).get();
  }
  return metricRegistry;
}

代码示例来源:origin: oracle/helidon

public RequestContextController getRequestContextController() {
    if (requestContextController == null) {
      CDI<Object> cdi = CDI.current();
      if (cdi != null) {
        requestContextController = cdi.select(RequestContextController.class).get();
      }
    }
    return requestContextController;
  }
}

代码示例来源:origin: javaee-samples/javaee7-samples

private void callCDIBean(HttpServletRequest request, HttpServletResponse response, String phase) {
  try {
    CDIBean cdiBean = CDI.current().select(CDIBean.class).get();
    response.getWriter().write(phase + ": " + cdiBean.getText() + "\n");
    
    cdiBean.setTextViaInjectedRequest();
    
    response.getWriter().write(phase + ": " + request.getAttribute("text")+ "\n");
    
  } catch (Exception e) {
    logger.log(SEVERE, "", e);
  }
}

代码示例来源:origin: oracle/helidon

private Object getClaimValue(CreationalContext<Object> context) {
  JsonWebTokenImpl token = CDI.current().select(JsonWebTokenImpl.class, new Impl() {
    @Override
    public Class<? extends Annotation> annotationType() {
      return Impl.class;
    }
  }).get();
  return getClaimValue(qualifier.name(), token, qualifier);
}

代码示例来源:origin: oracle/helidon

if (handlerClass != null) {
  FallbackHandler<?> handler = CDI.current().select(handlerClass).get();
  result = handler.handle(
      new ExecutionContext() {

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

@Override
public Instance<Object> createInstance()
{
  return OwbCDI.current().select(DefaultLiteral.INSTANCE);
}

代码示例来源:origin: org.microbean/microbean-eclipselink-cdi

/**
 * Returns a non-{@code null} {@link TransactionManager}.
 *
 * @return a non-{@code null} {@link TransactionManager}
 */
@Override
protected final TransactionManager acquireTransactionManager() {
 return CDI.current().select(TransactionManager.class).get();
}

代码示例来源:origin: org.talend.sdk.component/component-server-proxy

@Override
  public <T> T lookup(final Class<T> type) {
    return CDI.current().select(type, UiSpecProxy.Literal.INSTANCE).get();
  }
}

代码示例来源:origin: kumuluz/kumuluzee

private Object getBean(Class<?> clazz, boolean cdiPresent) {
  //cdi
  if (cdiPresent) {
    return CDI.current().select(clazz).get();
  }
  //pojo instance
  try {
    return clazz.getConstructor().newInstance();
  } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
    throw new RuntimeException("Unable to instantiate bean from " + clazz, e);
  }
}

代码示例来源:origin: br.com.jarch/jarch-utils

@Deprecated
  public static <T> T getInstanceReference(Class<T> clazz) {
//        Bean<T> bean = (Bean<T>) beanManager.resolve(beanManager.getBeans(clazz));
//        return beanManager.getContext(bean.getScope()).get(bean, beanManager.createCreationalContext(bean));
    return CDI.current().select(clazz).get();
  }
}

代码示例来源:origin: br.com.jarch/jarch-jpa

ClientJpaql(Class<E> classEntity) {
  entityManager = CDI.current().select(EntityManager.class).get();
  this.classEntity = classEntity;
  paramFieldValues = new ParamFieldValues(classEntity);
  orderBys = new ArrayList<>();
  groupBys = new ArrayList<>();
  aggregates = new ArrayList<>();
  joinFetchs = new ArrayList<>();
}

代码示例来源:origin: org.jboss.narayana.jts/narayana-jts-idlj

@Override
public final T create(final CreationalContext<T> cc) {
  try {
    return this.type.cast(CDI.current().select(InitialContext.class).get().lookup(this.name));
  } catch (final NamingException namingException) {
    throw new CreationException(namingException.getMessage(), namingException);
  }
}

代码示例来源:origin: org.commonjava.cdi.util/weft

@PostConstruct
public void init()
{
  try
  {
    this.metricRegistry = CDI.current().select( MetricRegistry.class).get();
  }
  catch ( UnsatisfiedResolutionException e )
  {
    logger.info( e.getMessage() );
  }
}

代码示例来源:origin: ws.ament.hammock/web-spi

public void startWebTier(@Observes AfterDeploymentValidation adv) {
    StartWebServer startWebServer = CDI.current().select(StartWebServer.class).get();
    startWebServer.start();
  }
}

代码示例来源:origin: org.apache.geronimo/geronimo-openapi-impl

@Override
  public void customize(final JAXRSServerFactoryBean bean) {
    if (bean.getProviders().stream().anyMatch(OpenAPIFilter.class::isInstance)) { // default app, nothing to do
      return;
    }
    bean.setProvider(CDI.current().select(OpenAPIFilter.class).get());
  }
}

代码示例来源:origin: br.com.jarch/jarch-crud

@PreUpdate
public void preRemoveLogic(ICrudEntity entity) {
  if (entity.getDateHourLogicExclusion() == null) {
    return;
  }
  CDI.current().select(RelationshipAnotherEntity.class).get().verify(CDI.current().select(EntityManager.class).get(), entity);
}

代码示例来源:origin: demoiselle/framework

@AroundInvoke
  public Object constructConfiguration(final InvocationContext ic) throws Exception {
    final ConfigurationLoader configurationLoader = CDI.current().select(ConfigurationLoader.class).get();

    final Class<?> baseClass = ic.getMethod().getDeclaringClass();
    configurationLoader.load(ic.getTarget(), baseClass);
    return ic.proceed();
  }
}

代码示例来源:origin: br.com.jarch/jarch-bpm

public static void claim(String taskId) {
    Response response = getWebTarget()
        .path(TASK)
        .path(taskId)
        .path(CLAIM)
        .request()
//                .header("Content-Type", MediaType.APPLICATION_JSON)
        .post(Entity.json(Json.createObjectBuilder().add(USER_ID, CDI.current().select(UserInformation.class).get().get().getId().toString()).build()));

    validResponse(response);
  }

代码示例来源:origin: org.glassfish.soteria/javax.security.enterprise

/**
 * Called in response to a {@link HttpServletRequest#logout()} call.
 *
 */
@Override
public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException {
  HttpMessageContext msgContext = new HttpMessageContextImpl(handler, messageInfo, subject);
  
  CDI.current()
    .select(HttpAuthenticationMechanism.class).get()
    .cleanSubject(msgContext.getRequest(), msgContext.getResponse(), msgContext);
}

代码示例来源:origin: br.com.jarch/jarch-jsf

public void searchCep() {
    if (zipCode.getSubmittedValue() == null) {
      return;
    }

    CepBean cepBean = CDI.current().select(CepService.class).get().buscaCep(zipCode.getSubmittedValue().toString());
    publicPlace.setValue(cepBean.getLogradouro());
    complement.setValue("");
    district.setValue(cepBean.getBairro());
    county.setValue(cepBean.getMunicipio());
    state.setValue(cepBean.getEstado());
  }
}

相关文章