private void bindWaeRestoringExceptionMapper() { GenericCdiBeanSupplier beanSupplier = new GenericCdiBeanSupplier(TransactionalExceptionMapper.class, injectionManager, beanManager, true); Binding binding = Bindings.supplier(beanSupplier).to(ExceptionMapper.class); injectionManager.register(binding); }
@Override public boolean bind(Class<?> component, Set<Class<?>> providerContracts) { if (ctx == null) { return false; } if (AnnotationUtils.findAnnotation(component, Component.class) != null) { String[] beanNames = ctx.getBeanNamesForType(component); if (beanNames == null || beanNames.length != 1) { LOGGER.severe(LocalizationMessages.NONE_OR_MULTIPLE_BEANS_AVAILABLE(component)); return false; } String beanName = beanNames[0]; Binding binding = Bindings.supplier(new SpringManagedBeanFactory(ctx, injectionManager, beanName)) .to(component) .to(providerContracts); injectionManager.register(binding); LOGGER.config(LocalizationMessages.BEAN_REGISTERED(beanNames[0])); return true; } return false; }
@Override protected void configure() { bindFactory(ReferencingFactory.<ApplicationInfo>referenceFactory()) .to(new GenericType<Ref<ApplicationInfo>>() { }) .in(Singleton.class); bindFactory(ApplicationInfoInjectionFactory.class) .to(ApplicationInfo.class); } });
@SuppressWarnings("unchecked") @Override public boolean bind(Class<?> component, Set<Class<?>> providerContracts) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(LocalizationMessages.EJB_CLASS_BEING_CHECKED(component)); } if (injectionManager == null) { throw new IllegalStateException(LocalizationMessages.EJB_COMPONENT_PROVIDER_NOT_INITIALIZED_PROPERLY()); } if (!isEjbComponent(component)) { return false; } if (!ejbInterceptorRegistered) { registerEjbInterceptor(); } Binding binding = Bindings.supplier(new EjbFactory(component, initialContext, EjbComponentProvider.this)) .to(component) .to(providerContracts); injectionManager.register(binding); if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.config(LocalizationMessages.EJB_CLASS_BOUND_WITH_CDI(component)); } return true; }
@Override protected void configure() { bindFactory(ReferencingFactory.<ApplicationInfo>referenceFactory()) .to(new GenericType<Ref<ApplicationInfo>>() { }) .in(Singleton.class); bindFactory(ApplicationInfoInjectionFactory.class) .to(ApplicationInfo.class); } });
.to(new GenericType<Ref<HttpServletRequest>>() {}).in(RequestScoped.class); .proxy(true).proxyForSameScope(false).in(RequestScoped.class); bindFactory(ReferencingFactory.referenceFactory()) .to(new GenericType<Ref<HttpServletResponse>>() {}).in(RequestScoped.class); bindFactory(webConfig::getServletContext).to(ServletContext.class).in(Singleton.class); bindFactory(() -> servletConfig).to(ServletConfig.class).in(Singleton.class); bindFactory(webConfig::getFilterConfig).to(FilterConfig.class).in(Singleton.class); bindFactory(() -> webConfig).to(WebConfig.class).in(Singleton.class);
@Override protected void configure() { bindFactory(JettyRequestReferencingFactory.class).to(Request.class) .proxy(false).in(RequestScoped.class); bindFactory(ReferencingFactory.<Request>referenceFactory()).to(new GenericType<Ref<Request>>() {}) .in(RequestScoped.class); bindFactory(JettyResponseReferencingFactory.class).to(Response.class) .proxy(false).in(RequestScoped.class); bindFactory(ReferencingFactory.<Response>referenceFactory()).to(new GenericType<Ref<Response>>() {}) .in(RequestScoped.class); } }
.to(new GenericType<Ref<HttpServletRequest>>() {}).in(RequestScoped.class); .proxy(true).proxyForSameScope(false).in(RequestScoped.class); bindFactory(ReferencingFactory.referenceFactory()) .to(new GenericType<Ref<HttpServletResponse>>() {}).in(RequestScoped.class); bindFactory(webConfig::getServletContext).to(ServletContext.class).in(Singleton.class); bindFactory(() -> servletConfig).to(ServletConfig.class).in(Singleton.class); bindFactory(webConfig::getFilterConfig).to(FilterConfig.class).in(Singleton.class); bindFactory(() -> webConfig).to(WebConfig.class).in(Singleton.class);
@Override protected void configure() { bindFactory(GrizzlyRequestReferencingFactory.class).to(Request.class) .proxy(false).in(RequestScoped.class); bindFactory(ReferencingFactory.<Request>referenceFactory()).to(new GenericType<Ref<Request>>() {}) .in(RequestScoped.class); bindFactory(GrizzlyResponseReferencingFactory.class).to(Response.class) .proxy(true).proxyForSameScope(false).in(RequestScoped.class); bindFactory(ReferencingFactory.<Response>referenceFactory()).to(new GenericType<Ref<Response>>() {}) .in(RequestScoped.class); } }
@Override protected void configure() { bindFactory(ReferencingFactory.<MonitoringStatistics>referenceFactory()) .to(new GenericType<Ref<MonitoringStatistics>>() { }) .in(Singleton.class); bindFactory(StatisticsInjectionFactory.class).to(MonitoringStatistics.class); bind(StatisticsListener.class).to(MonitoringStatisticsListener.class).in(Singleton.class); } });
@Override protected void configure() { bindFactory(ReferencingFactory.<MonitoringStatistics>referenceFactory()) .to(new GenericType<Ref<MonitoringStatistics>>() { }) .in(Singleton.class); bindFactory(StatisticsInjectionFactory.class).to(MonitoringStatistics.class); bind(StatisticsListener.class).to(MonitoringStatisticsListener.class).in(Singleton.class); } });
@Override protected void configure() { bindFactory(SimpleRequestReferencingFactory.class).to(Request.class).proxy(true) .proxyForSameScope(false).in(RequestScoped.class); bindFactory(ReferencingFactory.<Request>referenceFactory()) .to(new GenericType<Ref<Request>>() { }).in(RequestScoped.class); bindFactory(SimpleResponseReferencingFactory.class).to(Response.class).proxy(true) .proxyForSameScope(false).in(RequestScoped.class); bindFactory(ReferencingFactory.<Response>referenceFactory()) .to(new GenericType<Ref<Response>>() { }).in(RequestScoped.class); } }
@Override protected void configure() { install(new MessagingBinders.MessageBodyProviders(clientRuntimeProperties, RuntimeType.CLIENT), new MessagingBinders.HeaderDelegateProviders()); bindFactory(ReferencingFactory.referenceFactory()).to(new GenericType<Ref<ClientConfig>>() { }).in(RequestScoped.class); bindFactory(RequestContextInjectionFactory.class) .to(ClientRequest.class) .in(RequestScoped.class); bindFactory(ReferencingFactory.referenceFactory()).to(new GenericType<Ref<ClientRequest>>() { }).in(RequestScoped.class); bindFactory(PropertiesDelegateFactory.class, Singleton.class).to(PropertiesDelegate.class).in(RequestScoped.class); // ChunkedInput entity support bind(ChunkedInputReader.class).to(MessageBodyReader.class).in(Singleton.class); } }
@Override protected void configure() { install(new MessagingBinders.MessageBodyProviders(clientRuntimeProperties, RuntimeType.CLIENT), new MessagingBinders.HeaderDelegateProviders()); bindFactory(ReferencingFactory.referenceFactory()).to(new GenericType<Ref<ClientConfig>>() { }).in(RequestScoped.class); bindFactory(RequestContextInjectionFactory.class) .to(ClientRequest.class) .in(RequestScoped.class); bindFactory(ReferencingFactory.referenceFactory()).to(new GenericType<Ref<ClientRequest>>() { }).in(RequestScoped.class); bindFactory(PropertiesDelegateFactory.class, Singleton.class).to(PropertiesDelegate.class).in(RequestScoped.class); // ChunkedInput entity support bind(ChunkedInputReader.class).to(MessageBodyReader.class).in(Singleton.class); } }
@Override protected void configure() { bindFactory(WebServerRequestReferencingFactory.class).to(ServerRequest.class) .proxy(false) .in(RequestScoped.class); bindFactory(ReferencingFactory.<ServerRequest>referenceFactory()).to(new GenericType<Ref<ServerRequest>>() { }) .in(RequestScoped.class); bindFactory(WebServerResponseReferencingFactory.class).to(ServerResponse.class) .proxy(true).proxyForSameScope(false) .in(RequestScoped.class); bindFactory(ReferencingFactory.<ServerResponse>referenceFactory()).to(new GenericType<Ref<ServerResponse>>() { }) .in(RequestScoped.class); bindFactory(SpanReferencingFactory.class).to(Span.class) .proxy(false) .in(RequestScoped.class).named(JerseySupport.REQUEST_SPAN_QUALIFIER); bindFactory(SpanContextReferencingFactory.class).to(SpanContext.class) .proxy(false) .in(RequestScoped.class).named(JerseySupport.REQUEST_SPAN_CONTEXT); bindFactory(ReferencingFactory.<Span>referenceFactory()).to(new GenericType<Ref<Span>>() { }) .in(RequestScoped.class); bindFactory(ReferencingFactory.<SpanContext>referenceFactory()).to(new GenericType<Ref<SpanContext>>() { }) .in(RequestScoped.class); }
@Override protected void configure() { install(new MessagingBinders.MessageBodyProviders(clientRuntimeProperties, RuntimeType.CLIENT), new MessagingBinders.HeaderDelegateProviders()); bindFactory(ReferencingFactory.referenceFactory()).to(new GenericType<Ref<ClientConfig>>() { }).in(RequestScoped.class); bindFactory(RequestContextInjectionFactory.class) .to(ClientRequest.class) .in(RequestScoped.class); bindFactory(ReferencingFactory.referenceFactory()).to(new GenericType<Ref<ClientRequest>>() { }).in(RequestScoped.class); bindFactory(PropertiesDelegateFactory.class, Singleton.class).to(PropertiesDelegate.class).in(RequestScoped.class); // ChunkedInput entity support bind(ChunkedInputReader.class).to(MessageBodyReader.class).in(Singleton.class); } }
@Override protected void configure() { bindFactory(SecurityContextRefFactory.class) .to(SecurityContext.class) .proxy(true) .proxyForSameScope(false) .in(RequestScoped.class); bindFactory(ReferencingFactory.<SecurityContext>referenceFactory()) .to(new GenericType<Ref<SecurityContext>>() { }) .in(RequestScoped.class); bind(security).to(Security.class); bind(featureConfig).to(FeatureConfig.class); } });