0 Replies Latest reply on May 16, 2011 3:36 PM by webdevwilson

    Injecting in to classes in dependent jars

    webdevwilson
      I am trying to create a framework of sorts and would like to inject a Config object in to a named bean.  This bean exists in a jar that is a dependent of a webapp.  When I run the app, my Config object fails to be injected in to the bean (it's null).  I am thinking that since the classes are in different classloaders, there are in different contexts (perhaps a parent-child thing).  Is there any way to do this, or a better pattern to use?

      Here is kind of what it looks like:

      in api.jar:
      <pre>
      @Named 
      public class SomeBean { 
       
        @Inject private Config config; 
       

       
      public interface Config {} 

      </pre>

      in my war:
      <pre>
      @Named 
      public class MyConfig implements Config { 
       
      }
      </pre>