Ah, you are running into an earlier DI limitation. All DI collection item *types* needed to be bound explicitly in DI before you can add them to collections. E.g.:
// this looks a bit ugly, but ensures that CacheInvalidationFilter singleton // can be referenced as collection/map element binder.bind(CacheInvalidationFilter.class).to(CacheInvalidationFilter.class); // now that the type is known in DI, we can add it to the filter list binder.bindList(Constants.SERVER_DOMAIN_FILTERS_LIST).add(CacheInvalidationFilter.class); This limitation is resolved in 4.0.M3 per https://issues.apache.org/jira/browse/CAY-2035 , so the first line is no longer needed. >> CacheInvalidationFilter cacheInvalidationFilter = new >> CacheInvalidationFilter(); >> cayenneRuntime.getDataDomain().addFilter(cacheInvalidationFilter); This is also a valid solution. Andrus > On Feb 4, 2016, at 6:23 PM, Frank Herrmann > <frank.herrm...@modernizingmedicine.com> wrote: > > Hi Andrus, > > Following the documentation, I tried to add the following to the DI Module: > > public class M2CayenneModule implements Module{ >> @Override >> public void configure(Binder binder) { >> binder.bind(DataDomain.class).toProvider(M2DataDomainProvider.class); >> binder.bind(QueryCache.class).to(M2EhCacheQueryCache.class); >> >> binder.bindList(Constants.SERVER_DOMAIN_FILTERS_LIST).add(CacheInvalidationFilter.class); >> } >> } > > > However, the following error is generated, > > DI container has no binding for key <BindingKey: > org.apache.cayenne.lifecycle.cache.CacheInvalidationFilter> > > It does seem to work if I use this method, after the runtime is created: > >> >> CacheInvalidationFilter cacheInvalidationFilter = new >> CacheInvalidationFilter(); >> cayenneRuntime.getDataDomain().addFilter(cacheInvalidationFilter); > > > Is implementing the CacheInvalidationFilter via DI not available in Cayenne > 3.1? > > Thanks again, > > -Frank > > On Thu, Feb 4, 2016 at 9:41 AM, Frank Herrmann < > frank.herrm...@modernizingmedicine.com> wrote: > >> Thanks again for all the help. >> >> -Frank >> >> On Thu, Feb 4, 2016 at 2:22 AM, Andrus Adamchik <and...@objectstyle.org> >> wrote: >> >>> >>> >>> >>>> On Feb 4, 2016, at 9:33 AM, Andrus Adamchik <and...@objectstyle.org> >>> wrote: >>>> >>>> (Hmm, why don't I copy the above to our docs :)) >>> >>> Here it is for 4.0: >>> >>> >>> https://github.com/apache/cayenne/commit/5d3e141a9635dc28ce358d048840e74b76b2b0fd >>> >>> We'll publish it on the site in a few days hopefully.. >>> >>> Andrus >> >> >> >> >> -- >> FRANK HERRMANN >> SOFTWARE ENGINEER >> >> T: 561-880-2998 x1563 >> >> E: frank.herrm...@modmed.com >> >> >> >> [image: [ Modernizing Medicine ]] <http://www.modmed.com/> >> [image: [ Facebook ]] <http://www.facebook.com/modernizingmedicine> [image: >> [ LinkedIn ]] <http://www.linkedin.com/company/modernizing-medicine/> [image: >> [ YouTube ]] <http://www.youtube.com/user/modernizingmedicine> [image: [ >> Twitter ]] <https://twitter.com/modmed_EMA> [image: [ Blog ]] >> <http://www.modmed.com/BlogBeyondEMR> [image: [ Instagram ]] >> <http://instagram.com/modernizing_medicine> >> >> > > > -- > FRANK HERRMANN > SOFTWARE ENGINEER > > T: 561-880-2998 x1563 > > E: frank.herrm...@modmed.com > > > > [image: [ Modernizing Medicine ]] <http://www.modmed.com/> > [image: [ Facebook ]] <http://www.facebook.com/modernizingmedicine> [image: > [ LinkedIn ]] <http://www.linkedin.com/company/modernizing-medicine/> [image: > [ YouTube ]] <http://www.youtube.com/user/modernizingmedicine> [image: [ > Twitter ]] <https://twitter.com/modmed_EMA> [image: [ Blog ]] > <http://www.modmed.com/BlogBeyondEMR> [image: [ Instagram ]] > <http://instagram.com/modernizing_medicine>