Java Code Examples for javax.enterprise.inject.spi.BeforeBeanDiscovery#addInterceptorBinding()

The following examples show how to use javax.enterprise.inject.spi.BeforeBeanDiscovery#addInterceptorBinding() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FaultToleranceExtension.java    From smallrye-fault-tolerance with Apache License 2.0 6 votes vote down vote up
void registerInterceptorBindings(@Observes BeforeBeanDiscovery bbd, BeanManager bm) {
    LOGGER.info("MicroProfile: Fault Tolerance activated");
    bbd.addInterceptorBinding(new FTInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(CircuitBreaker.class)));
    bbd.addInterceptorBinding(new FTInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Retry.class)));
    bbd.addInterceptorBinding(new FTInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Timeout.class)));
    bbd.addInterceptorBinding(new FTInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Asynchronous.class)));
    bbd.addInterceptorBinding(new FTInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Fallback.class)));
    bbd.addInterceptorBinding(new FTInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Bulkhead.class)));

    // It seems that fraction deployment module cannot be picked up as a CDI bean archive - see also SWARM-1725
    bbd.addAnnotatedType(bm.createAnnotatedType(FaultToleranceInterceptor.class),
            FaultToleranceInterceptor.class.getName());
    bbd.addAnnotatedType(bm.createAnnotatedType(DefaultFallbackHandlerProvider.class),
            DefaultFallbackHandlerProvider.class.getName());
    bbd.addAnnotatedType(bm.createAnnotatedType(ExecutorProvider.class),
            ExecutorProvider.class.getName());
    bbd.addAnnotatedType(bm.createAnnotatedType(DefaultFaultToleranceOperationProvider.class),
            DefaultFaultToleranceOperationProvider.class.getName());
    bbd.addAnnotatedType(bm.createAnnotatedType(MetricsCollectorFactory.class), MetricsCollectorFactory.class.getName());
    bbd.addAnnotatedType(bm.createAnnotatedType(StrategyCache.class), StrategyCache.class.getName());
}
 
Example 2
Source File: MeecrowaveExtension.java    From openwebbeans-meecrowave with Apache License 2.0 5 votes vote down vote up
void addBeansFromJava(@Observes final BeforeBeanDiscovery bbd, final BeanManager bm) {
    if (Cxfs.IS_PRESENT) {
        bbd.addInterceptorBinding(JAXRSFieldInjectionInterceptor.Binding.class);

        Stream.of(MeecrowaveBus.class, JAXRSFieldInjectionInterceptor.class)
              .forEach(type -> bbd.addAnnotatedType(bm.createAnnotatedType(type)));
    }
}
 
Example 3
Source File: CdiHelper.java    From metrics-cdi with Apache License 2.0 5 votes vote down vote up
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));
}
 
Example 4
Source File: SwaggerExtension.java    From thorntail with Apache License 2.0 4 votes vote down vote up
/**
 * Associate the InterceptorBinding annotation.
 */
public void processBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager) {
    event.addInterceptorBinding(beanManager.createAnnotatedType(AddSwaggerResources.class));
    event.addAnnotatedType(beanManager.createAnnotatedType(SwaggerRestApplicationInterceptor.class), SwaggerRestApplicationInterceptor.class.getName());
}
 
Example 5
Source File: SimpleCacheExtension.java    From deltaspike with Apache License 2.0 4 votes vote down vote up
void discoverInterceptorBindings(@Observes BeforeBeanDiscovery beforeBeanDiscoveryEvent)
{
    beforeBeanDiscoveryEvent.addInterceptorBinding(SimpleCache.class);
}
 
Example 6
Source File: SimpleCacheExtension.java    From deltaspike with Apache License 2.0 4 votes vote down vote up
void discoverInterceptorBindings(@Observes BeforeBeanDiscovery beforeBeanDiscoveryEvent)
{
    beforeBeanDiscoveryEvent.addInterceptorBinding(SimpleCache.class);
}