congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
BeforeBeanDiscovery
Code IndexAdd Tabnine to your IDE (free)

How to use
BeforeBeanDiscovery
in
javax.enterprise.inject.spi

Best Java code snippets using javax.enterprise.inject.spi.BeforeBeanDiscovery (Showing top 20 results out of 909)

Refine searchRefine arrow

  • Observes
  • BeanManager
  • VetoedSuppressedAnnotatedType
origin: jersey/jersey

  @SuppressWarnings("unused")
  private void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery beforeBeanDiscovery, final javax.enterprise.inject.spi
      .BeanManager beanManager) {
    beforeBeanDiscovery.addAnnotatedType(beanManager.createAnnotatedType(WebAppExceptionHolder.class));
    beforeBeanDiscovery.addAnnotatedType(beanManager.createAnnotatedType(WebAppExceptionInterceptor.class));
    beforeBeanDiscovery.addAnnotatedType(beanManager.createAnnotatedType(TransactionalExceptionMapper.class));
  }
}
origin: wildfly/wildfly

  public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager manager) {
    event.addScope(ViewScoped.class, true, true);
  }
}
origin: oracle/helidon

/**
 * Adds interceptor bindings and annotated types.
 *
 * @param discovery Event information.
 * @param bm Bean manager instance.
 */
void registerInterceptorBindings(@Observes BeforeBeanDiscovery discovery, BeanManager bm) {
  // Check if fault tolerance and its metrics are enabled
  final Config config = ConfigProvider.getConfig();
  isFaultToleranceEnabled = config.getOptionalValue(MP_FT_NON_FALLBACK_ENABLED, Boolean.class)
      .orElse(true);      // default is enabled
  isFaultToleranceMetricsEnabled = config.getOptionalValue(MP_FT_METRICS_ENABLED, Boolean.class)
      .orElse(true);      // default is enabled
  discovery.addInterceptorBinding(new InterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Retry.class)));
  discovery.addInterceptorBinding(new InterceptorBindingAnnotatedType<>(bm.createAnnotatedType(CircuitBreaker.class)));
  discovery.addInterceptorBinding(new InterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Timeout.class)));
  discovery.addInterceptorBinding(new InterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Asynchronous.class)));
  discovery.addInterceptorBinding(new InterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Bulkhead.class)));
  discovery.addInterceptorBinding(new InterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Fallback.class)));
  discovery.addAnnotatedType(bm.createAnnotatedType(CommandInterceptor.class), CommandInterceptor.class.getName());
}
origin: weld/core

void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager) {
  event.addAnnotatedType(VetoedSuppressedAnnotatedType.from(ActivateRequestContextInterceptor.class, beanManager),
      ActivateRequestContextInterceptor.class.getName());
  event.addAnnotatedType(VetoedSuppressedAnnotatedType.from(CdiRequestContextActivatorInterceptor.class, beanManager),
      CdiRequestContextActivatorInterceptor.class.getName());
}
origin: org.jboss.narayana.jta/cdi

public void register(@Observes BeforeBeanDiscovery bbd, BeanManager bm) {        
  
  bbd.addScope(TransactionScoped.class, true, true);
  bbd.addAnnotatedType(bm.createAnnotatedType(TransactionalInterceptorMandatory.class), TransactionalInterceptorMandatory.class.getName() + TX_INTERCEPTOR);
  bbd.addAnnotatedType(bm.createAnnotatedType(TransactionalInterceptorNever.class), TransactionalInterceptorNever.class.getName() + TX_INTERCEPTOR);
  bbd.addAnnotatedType(bm.createAnnotatedType(TransactionalInterceptorNotSupported.class), TransactionalInterceptorNotSupported.class.getName() + TX_INTERCEPTOR);
  bbd.addAnnotatedType(bm.createAnnotatedType(TransactionalInterceptorRequired.class), TransactionalInterceptorRequired.class.getName() + TX_INTERCEPTOR);
  bbd.addAnnotatedType(bm.createAnnotatedType(TransactionalInterceptorRequiresNew.class), TransactionalInterceptorRequiresNew.class.getName() + TX_INTERCEPTOR);
  bbd.addAnnotatedType(bm.createAnnotatedType(TransactionalInterceptorSupports.class), TransactionalInterceptorSupports.class.getName() + TX_INTERCEPTOR);
}
origin: org.glassfish.main.web/web-sse

@SuppressWarnings("UnusedDeclaration")
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager bm) {
  bbd.addQualifier(ServerSentEventContext.class);
}
origin: oracle/helidon

/**
 * Initializes the extension prior to bean discovery.
 *
 * @param discovery bean discovery event
 */
public void before(@Observes BeforeBeanDiscovery discovery) {
  // Register beans manually
  discovery.addAnnotatedType(JsonWebTokenProducer.class, "TokenProducer");
}
origin: tomitribe/microscoped

public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {
  bbd.addScope(TimerScoped.class, true, false);
  bbd.addInterceptorBinding(TimerScopeEnabled.class);
}
origin: org.jboss.cdi.tck/cdi-tck-impl

public void addQualifierByAnnotatedType(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager) {
  setObserved(true);
  // add @Skill(language(); @Nonbinding level()) as qualifier
  beforeBeanDiscovery.addQualifier(new AnnotatedTypeWrapper<Skill>(beanManager.createAnnotatedType(Skill.class), true) {
    Set<AnnotatedMethod<? super Skill>> methods;
    {
      methods = new HashSet<AnnotatedMethod<? super Skill>>();
      for (final AnnotatedMethod<? super Skill> method : super.getMethods()) {
        if ("level".equals(method.getJavaMember().getName())) {
          methods.add(new AnnotatedMethodWrapper<Skill>((AnnotatedMethod<Skill>) method, this, true,
              new AnnotationLiteral<Nonbinding>() {
              }));
        } else {
          methods.add(new AnnotatedMethodWrapper<Skill>((AnnotatedMethod<Skill>) method, this, true));
        }
      }
    }
    @Override
    public Set<AnnotatedMethod<? super Skill>> getMethods() {
      return methods;
    }
  });
}
origin: org.jboss.cdi.tck/cdi-tck-impl

public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, final BeanManager beanManager)
    throws SecurityException, NoSuchMethodException {
  event.addInterceptorBinding(Incremented.class);
  event.addInterceptorBinding(FullMarathon.class);
  event.addInterceptorBinding(new AnnotatedTypeWrapper<Suffixed>(beanManager.createAnnotatedType(Suffixed.class), true) {
    Set<AnnotatedMethod<? super Suffixed>> methods;
origin: org.jsr107.ri/cache-annotations-ri-cdi

/**
 * Service interface implemented by extensions. An extension is a service provider declared in META-INF/services.
 *
 * @param beforeBeanDiscoveryEvent the event to register
 */
void discoverInterceptorBindings(@Observes BeforeBeanDiscovery beforeBeanDiscoveryEvent) {
 beforeBeanDiscoveryEvent.addInterceptorBinding(CachePut.class);
 beforeBeanDiscoveryEvent.addInterceptorBinding(CacheResult.class);
 beforeBeanDiscoveryEvent.addInterceptorBinding(CacheRemove.class);
 beforeBeanDiscoveryEvent.addInterceptorBinding(CacheRemoveAll.class);
}
origin: org.jboss.jsr299.tck/jsr299-tck-impl

public void observe(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
{
 setObserved(true);
 beforeBeanDiscovery.addQualifier(Tame.class);
 beforeBeanDiscovery.addScope(EpochScoped.class, false, false);
}
origin: org.jboss.seam.config/seam-config-xml

public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager)
    event.addQualifier(b);
    event.addInterceptorBinding(b);
    event.addStereotype(b.getKey(), b.getValue());
    log.info("Adding XML Defined Bean: " + tp.getJavaClass().getName());
    ProcessAnnotatedType<?> pat = new ProcessAnnotatedTypeImpl((AnnotatedType) tp);
    beanManager.fireEvent(pat, DefaultLiteral.INSTANCE);
    event.addAnnotatedType(pat.getAnnotatedType());
origin: org.apache.geronimo/geronimo-metrics

void letOtherExtensionsUseRegistries(@Observes final BeforeBeanDiscovery beforeBeanDiscovery, final BeanManager beanManager) {
  beforeBeanDiscovery.addQualifier(RegistryType.class);
  beanManager.fireEvent(applicationRegistry);
  beanManager.fireEvent(applicationRegistry, new RegistryTypeImpl(MetricRegistry.Type.APPLICATION));
  beanManager.fireEvent(baseRegistry, new RegistryTypeImpl(MetricRegistry.Type.BASE));
  beanManager.fireEvent(vendorRegistry, new RegistryTypeImpl(MetricRegistry.Type.VENDOR));
  // we make @Metric.name binding (to avoid to write producers relying on injection point)
  beforeBeanDiscovery.configureQualifier(org.eclipse.microprofile.metrics.annotation.Metric.class)
      .methods().stream().filter(method -> method.getAnnotated().getJavaMember().getName().equals("name"))
      .forEach(method -> method.remove(a -> a.annotationType() == Nonbinding.class));
}
origin: io.astefanutti.metrics.cdi/metrics-cdi

static <T extends Annotation> void declareAsInterceptorBinding(Class<T> annotation, BeanManager manager, BeforeBeanDiscovery bbd) {
  AnnotatedType<T> annotated = manager.createAnnotatedType(annotation);
  Set<AnnotatedMethod<? super T>> methods = new HashSet<>();
  for (AnnotatedMethod<? super T> method : annotated.getMethods())
    methods.add(new AnnotatedMethodDecorator<>(method, NON_BINDING));
  bbd.addInterceptorBinding(new AnnotatedTypeDecorator<>(annotated, INTERCEPTOR_BINDING, methods));
}
origin: org.jboss.cdi.tck/cdi-tck-impl

  void execute() {
    event.addScope(SimpleAnnotation.class, true, false);
  }
}.run();
origin: org.jboss.cdi.tck/cdi-tck-impl

  void execute() {
    event.addInterceptorBinding(annotation);
  }
}.run();
origin: org.jboss.cdi.tck/cdi-tck-impl

  void execute() {
    event.addQualifier(SimpleAnnotation.class);
  }
}.run();
origin: weld/core

void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager) {
  event.addAnnotatedType(VetoedSuppressedAnnotatedType.from(ActivateRequestContextInterceptor.class, beanManager),
      ActivateRequestContextInterceptor.class.getName());
  event.addAnnotatedType(VetoedSuppressedAnnotatedType.from(CdiRequestContextActivatorInterceptor.class, beanManager),
      CdiRequestContextActivatorInterceptor.class.getName());
}
origin: org.apache.myfaces.core/myfaces-impl

void beforeBeanDiscovery(
  @Observes final BeforeBeanDiscovery event, BeanManager beanManager)
{
  event.addScope(FlowScoped.class, true, true);
  // Register FlowBuilderFactoryBean as a bean with CDI annotations, so the system
  // can take it into account, and use it later when necessary.
  AnnotatedType bean = beanManager.createAnnotatedType(FlowScopeBeanHolder.class);
  event.addAnnotatedType(bean, bean.getJavaClass().getName());
}

javax.enterprise.inject.spiBeforeBeanDiscovery

Javadoc

This event type is thrown by the container before the bean discovery process begins. If any observer method of the BeforeBeanDiscovery event throws an exception, the exception is treated as a definition error by the container.

Most used methods

  • addAnnotatedType
    Adds new annotated type for classes which are not picked up by the CDI container or if you like to a
  • addScope
    Declares a new scope.
  • addInterceptorBinding
    Declare a new interceptor binding via the information from the given AnnotatedType.
  • addQualifier
    Declare a new qualifier via the information from the given AnnotatedType.
  • addStereotype
    Declares a new stereotype.
  • configureInterceptorBinding
    Obtains a new AnnotatedTypeConfigurator to configure a new javax.enterprise.inject.spi.AnnotatedTyp
  • configureQualifier
    Obtains a new AnnotatedTypeConfigurator to configure a new javax.enterprise.inject.spi.AnnotatedTyp

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (Timer)
  • addToBackStack (FragmentTransaction)
  • getSharedPreferences (Context)
  • String (java.lang)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now