Announcement Announcement Module
No announcement yet.
@Configuable not firing on (some) subclasses Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Configuable not firing on (some) subclasses

    For some reason this board thinks I'm trying to post a URL which I'm not. Details in 2nd post.

  • #2
    Basic hierarchy:
    interface DataObject
    abstract DataObjectCommonBase implements DataObject, tagged w/ @Configurable and one setter tagged w/ @Resource
    abstract DataObjectCommonSuper extends DataObjectCommonBase
    abstract AbstractObjectIdListCommonBase extends DataObjectCommonSuper
    abstract AbstractObjectIdList extends AbstractObjectIdListCommonBase
    abstract AbstractObjectStringIdList extends AbstractObjectIdListCommonBase

    There are many concrete implementations that extend DataObjectCommonSuper, and they all get the @Resource injected.

    The concrete implementations of AbstractObjectIdList do NOT get the @Resource injected.
    I haven't yet tested concrete implementations of AbstractObjectStringIdList.

    At first I thought it might be because the some of the abstract classes have non-public constructors, but I've made them public and I'm still not seeing the injection.

    I'll be doing more testing to try to nail this down, but was hoping somebody might having seen this before I spend all day debugging.

    We are using Spring 2.5.5 and resin 3.0.23 on JDK 1.6.


    • #3
      Found it. One of the constructors is doing work, assuming that dependency has already been injected. It gets injected at the end of the constructor, not at the beginning, so that's why I'm getting an NPE when on accessing that dependency. @Configurable can be made to do the injection at the start of the constructor, right? *consults documentation*

      edit: looks like preConstruction=true should do the trick

      edit2: that worked
      Last edited by efender; Mar 27th, 2009, 08:33 AM.