5 Replies Latest reply on Nov 18, 2014 9:46 AM by Martin Kouba

    Weld integration into JEE environment

    Emily Jiang Newbie

      I have integrated Weld into my JEE environment. I found the following sentence in the Weld Reference doc:

       

      Weld expects the Application Server or other container to provide the storage for each application's context.

      The org.jboss.weld.context.beanstore.BeanStore should be implemented to provide an application

      scoped storage.

       

       

      How to plug the implementation with the Weld framework? The other question is how to obtain an contextualInstance?

      thanks

      Emily

        • 1. Re: Weld integration into JEE environment
          Martin Kouba Master

          Hi,

          what's the target Java EE environment? In fact, I'm not really sure what the sentence means. I suspect it's outdated.

          The other question is how to obtain an contextualInstance?

          Could you provide more information? E.g. when and where?

          • 2. Re: Weld integration into JEE environment
            Emily Jiang Newbie

            I am trying to put Weld in WebSphere Application Server. If I don't need to implement BeanStore, my contextualInstance question is irrelevant any more.

             

            Carry on this thread... I have a problem with injection

            I have a servlet class, which declares @Inject to bean A, which then declares @Inject to bean B. I am aware of that I need to process the EE injection. I managed to inject A to my servlet. However, the injection bean B to bean A did not happen. Is there anything I need to do to make this happen? I thought Weld bootstrap process will have this injection wired up. I might be wrong. Is this any methods I need to call to kick start the injections?

            Thanks

            • 3. Re: Weld integration into JEE environment
              Martin Kouba Master

              It depends on the bean scope. If A is normal scoped (e.g. @RequestScoped) a client proxy is injected into the servlet and the bean instance is not created (and injected) unless A is really used. The same applies to B. What are the scopes of A and B? And how do you monitor the injection - @PostConstruct callback?

              • 4. Re: Weld integration into JEE environment
                Emily Jiang Newbie

                After debugging through, I found out the presence of InjectionServices stops Weld does the field injection for managed beans as I have not fully implemented InjectionServices as yet. The InjectionService is a required service in EE environment. I am not sure the difference between EE environment and EE_INJECT environment. Which one is more appropriate to an Application Server environment?

                • 5. Re: Weld integration into JEE environment
                  Martin Kouba Master

                  I am not sure the difference between EE environment and EE_INJECT environment. Which one is more appropriate to an Application Server environment?

                  Both environments are appropriate. The difference is in who is performing the EE-style injection. Environments.EE - the container/integrator performs the injection (Weld invokes an InjectionServices callback and provides some injection context). Environments.EE_INJECT - Weld performs EE-style injection (i.e. calls individual injection services to obtain the resource reference).