Refine search
@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)); } }
/** * 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()); }
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()); }
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); }
@SuppressWarnings("UnusedDeclaration") void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager bm) { bbd.addQualifier(ServerSentEventContext.class); }
/** * 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"); }
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) { bbd.addScope(TimerScoped.class, true, false); bbd.addInterceptorBinding(TimerScopeEnabled.class); }
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; } }); }
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;
/** * 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); }
public void observe(@Observes BeforeBeanDiscovery beforeBeanDiscovery) { setObserved(true); beforeBeanDiscovery.addQualifier(Tame.class); beforeBeanDiscovery.addScope(EpochScoped.class, false, false); }
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());
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)); }
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)); }
void execute() { event.addScope(SimpleAnnotation.class, true, false); } }.run();
void execute() { event.addInterceptorBinding(annotation); } }.run();
void execute() { event.addQualifier(SimpleAnnotation.class); } }.run();
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()); }
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()); }