Thank you Jozef! How can I control which BeanManager is retrieved from the WeldInitialListener, which has the following logic to work out which bean manager is used. {code} @Inject private BeanManagerImpl beanManager; private HttpContextLifecycle lifecycle; final ServletContext ctx = sce.getServletContext(); // First try to use the context id obtained from the servlet context (OSGi, Servlet containers, etc.) if (beanManager == null) { String contextId = ctx.getInitParameter(Container.CONTEXT_ID_KEY); if (contextId != null) { List<BeanManagerImpl> managers = new ArrayList<BeanManagerImpl>(Container.instance(contextId).beanDeploymentArchives().values()); Collections.sort(managers, BeanManagers.ID_COMPARATOR); beanManager = managers.get(0); } } {code} How can the injection work as the Weld bundle is not a bean archive? I am running in an OSGi environment. The bean manager will be null and then in the contextInitialized, the bean manager with the smallest id will be used. How can I ensure the correct one to be used then?
|