Announcement Announcement Module
No announcement yet.
Strange injection issue Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Strange injection issue

    I have a base service containing daos and subservices inherit from that

    <bean id="baseService" class="foo.BaseServiceImpl" abstract="true">
       <property name="fooDao" ref="fooDao"/>
    <bean id="fooService" class="foo.FooServiceImpl" parent="baseService"/>
    The problem is that one fooService method uses the dao just fine but another throws a NPE on the dao just like it wouldn't have been injected! How can the same service see the dao in one method but not in the second?

    FooServiceImpl extends BaseServiceImpl and I have several other services with the same setup, all working fine. There shouldn't be any old compiled classes interfering. I just don't get it.

    Thankful for assistance,

  • #2
    Hmm that does sound very strange indeed. I'm not meaning to offend, but your not using the new operator anywhere and creating your service instead of looking it up? Is it possible to see the code and the applicationContext?


    • #3
      No offence - because you were right! I should have looked through *all* my config files becase there was a conflicting bean (that didn't inherit) in my webservice-config that did the second call. Ngh, I'll just go hide somewhere now...


      • #4
        , thats ok. I didn't want to insult you by suggesting such a thing, but I've had to debug the same thing before! Glad you found it anyway!