The class with the collectionFactory is ToManyListFault in the core Cayenne framework. It's not managed by the container (as far as I know), but it's not part of my application. What determines if something is 'managed by the container'? When a field is marked with @Inject, when does the injection actually occur and what object performs the injection?
Thanks, John On Mon, Jul 2, 2012 at 3:28 AM, Andrus Adamchik <[email protected]>wrote: > Is the class that contains 'collectionFactory' ivar also managed by > Cayenne DI container, or is this your application class? If it is the > former, then of course Cayenne injection will have no effect. > > Andrus > > On Jul 1, 2012, at 8:16 PM, John Huss wrote: > > > I'm trying to add a new DI binding and it's not working so I could use > some help. > > > > At the usage site I have this: > > @Inject private ToManyCollectionFactory collectionFactory; > > > > > > @Override > > > > public Object resolveFault(Persistent sourceObject, String > relationshipName) { > > > > return collectionFactory.createToManyList(sourceObject, > relationshipName); > > > > } > > > > > > The module is configured like so: > > > > > binder.bind(ToManyCollectionFactory.class).to(DefaultToManyCollectionFactory.class); > > > > But the collectionFactory is always null - it's not being injected. > What do I need to be doing? > > > > I'll attach the complete patch for reference. > > > > > > > > Thanks, > > > > John > > > >
